Skip to content

Commit d297ce3

Browse files
Merge pull request modelcontextprotocol#132 from evalstate/feature/resource-size
Add an optional 'size' field to the Resource type.
2 parents 51feed1 + e739e27 commit d297ce3

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

docs/specification/draft/server/resources.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ A resource definition includes:
246246
- `name`: Human-readable name
247247
- `description`: Optional description
248248
- `mimeType`: Optional MIME type
249+
- `size`: Optional size in bytes
249250

250251
### Resource Contents
251252

schema/schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,6 +1505,10 @@
15051505
"description": "A human-readable name for this resource.\n\nThis can be used by clients to populate UI elements.",
15061506
"type": "string"
15071507
},
1508+
"size": {
1509+
"description": "The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.\n\nThis can be used by Hosts to display file sizes and estimate context window usage.",
1510+
"type": "integer"
1511+
},
15081512
"uri": {
15091513
"description": "The URI of this resource.",
15101514
"format": "uri",

schema/schema.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,13 @@ export interface Resource extends Annotated {
443443
* The MIME type of this resource, if known.
444444
*/
445445
mimeType?: string;
446+
447+
/**
448+
* The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
449+
*
450+
* This can be used by Hosts to display file sizes and estimate context window usage.
451+
*/
452+
size?: number;
446453
}
447454

448455
/**

0 commit comments

Comments
 (0)