Skip to content

Commit 13bd351

Browse files
committed
Add optional "size" attribute to Resource, include in Documentation
1 parent b9d368f commit 13bd351

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

docs/specification/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
@@ -1506,6 +1506,10 @@
15061506
"description": "The URI of this resource.",
15071507
"format": "uri",
15081508
"type": "string"
1509+
},
1510+
"size": {
1511+
"description": "The size of the resource in bytes before any encoding or tokenization, if known.\n\nThis can be used by Hosts to display file sizes and estimate context window usage.",
1512+
"type": "number"
15091513
}
15101514
},
15111515
"required": [

schema/schema.ts

Lines changed: 10 additions & 3 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 resource in bytes before any encoding or 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
/**
@@ -814,14 +821,14 @@ export interface Annotated {
814821
annotations?: {
815822
/**
816823
* Describes who the intended customer of this object or data is.
817-
*
824+
*
818825
* It can include multiple entries to indicate content useful for multiple audiences (e.g., `["user", "assistant"]`).
819826
*/
820827
audience?: Role[];
821828

822829
/**
823830
* Describes how important this data is for operating the server.
824-
*
831+
*
825832
* A value of 1 means "most important," and indicates that the data is
826833
* effectively required, while 0 means "least important," and indicates that
827834
* the data is entirely optional.
@@ -831,7 +838,7 @@ export interface Annotated {
831838
* @maximum 1
832839
*/
833840
priority?: number;
834-
}
841+
};
835842
}
836843

837844
/**

0 commit comments

Comments
 (0)