Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an optional 'size' field to the Resource type. #132

Merged
Merged
1 change: 1 addition & 0 deletions docs/specification/draft/server/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ A resource definition includes:
- `name`: Human-readable name
- `description`: Optional description
- `mimeType`: Optional MIME type
- `size`: Optional size in bytes

### Resource Contents

Expand Down
4 changes: 4 additions & 0 deletions schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,10 @@
"description": "A human-readable name for this resource.\n\nThis can be used by clients to populate UI elements.",
"type": "string"
},
"size": {
"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.",
"type": "integer"
},
"uri": {
"description": "The URI of this resource.",
"format": "uri",
Expand Down
7 changes: 7 additions & 0 deletions schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,13 @@ export interface Resource extends Annotated {
* The MIME type of this resource, if known.
*/
mimeType?: string;

/**
* The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
*
* This can be used by Hosts to display file sizes and estimate context window usage.
*/
size?: number;
}

/**
Expand Down
Loading