From 13bd3518385d2d0fd429de8fd61d6c732a0753f7 Mon Sep 17 00:00:00 2001 From: = <1936278+evalstate@users.noreply.github.com> Date: Mon, 6 Jan 2025 21:54:50 +0000 Subject: [PATCH 1/4] Add optional "size" attribute to Resource, include in Documentation --- docs/specification/server/resources.md | 1 + schema/schema.json | 4 ++++ schema/schema.ts | 13 ++++++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/specification/server/resources.md b/docs/specification/server/resources.md index 98be752..1b94173 100644 --- a/docs/specification/server/resources.md +++ b/docs/specification/server/resources.md @@ -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 diff --git a/schema/schema.json b/schema/schema.json index ec5c4d2..0569e82 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -1506,6 +1506,10 @@ "description": "The URI of this resource.", "format": "uri", "type": "string" + }, + "size": { + "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.", + "type": "number" } }, "required": [ diff --git a/schema/schema.ts b/schema/schema.ts index 6492f62..bd3f95f 100644 --- a/schema/schema.ts +++ b/schema/schema.ts @@ -443,6 +443,13 @@ export interface Resource extends Annotated { * The MIME type of this resource, if known. */ mimeType?: string; + + /** + * The size of the resource in bytes before any encoding or tokenization, if known. + * + * This can be used by Hosts to display file sizes and estimate context window usage. + */ + size?: number; } /** @@ -814,14 +821,14 @@ export interface Annotated { annotations?: { /** * Describes who the intended customer of this object or data is. - * + * * It can include multiple entries to indicate content useful for multiple audiences (e.g., `["user", "assistant"]`). */ audience?: Role[]; /** * Describes how important this data is for operating the server. - * + * * A value of 1 means "most important," and indicates that the data is * effectively required, while 0 means "least important," and indicates that * the data is entirely optional. @@ -831,7 +838,7 @@ export interface Annotated { * @maximum 1 */ priority?: number; - } + }; } /** From 46f8b2f61841a691968827ed59d2d736f88c18e1 Mon Sep 17 00:00:00 2001 From: = <1936278+evalstate@users.noreply.github.com> Date: Mon, 6 Jan 2025 21:59:40 +0000 Subject: [PATCH 2/4] validation, simplify wording. --- schema/schema.json | 8 ++++---- schema/schema.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/schema/schema.json b/schema/schema.json index 5ec0e64..d360f7b 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -1505,14 +1505,14 @@ "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 resource in bytes before encoding or 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", "type": "string" - }, - "size": { - "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.", - "type": "number" } }, "required": [ diff --git a/schema/schema.ts b/schema/schema.ts index 8508a91..5025d28 100644 --- a/schema/schema.ts +++ b/schema/schema.ts @@ -445,7 +445,7 @@ export interface Resource extends Annotated { mimeType?: string; /** - * The size of the resource in bytes before any encoding or tokenization, if known. + * The size of the resource in bytes before encoding or tokenization, if known. * * This can be used by Hosts to display file sizes and estimate context window usage. */ From 050e2689f5e81284619a4804cc18571a2ddf18e4 Mon Sep 17 00:00:00 2001 From: = <1936278+evalstate@users.noreply.github.com> Date: Tue, 7 Jan 2025 19:40:49 +0000 Subject: [PATCH 3/4] remove spurious semicolon --- schema/schema.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/schema/schema.ts b/schema/schema.ts index 5025d28..86ba025 100644 --- a/schema/schema.ts +++ b/schema/schema.ts @@ -822,14 +822,14 @@ export interface Annotated { annotations?: { /** * Describes who the intended customer of this object or data is. - * + * * It can include multiple entries to indicate content useful for multiple audiences (e.g., `["user", "assistant"]`). */ audience?: Role[]; /** * Describes how important this data is for operating the server. - * + * * A value of 1 means "most important," and indicates that the data is * effectively required, while 0 means "least important," and indicates that * the data is entirely optional. @@ -839,7 +839,7 @@ export interface Annotated { * @maximum 1 */ priority?: number; - }; + } } /** From 05345e1e4969ebacd04be65e79f480080c408a0f Mon Sep 17 00:00:00 2001 From: evalstate <1936278+evalstate@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:39:02 +0000 Subject: [PATCH 4/4] Update schema/schema.ts Improved wording Co-authored-by: Justin Spahr-Summers --- schema/schema.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/schema.ts b/schema/schema.ts index 86ba025..589fb53 100644 --- a/schema/schema.ts +++ b/schema/schema.ts @@ -445,7 +445,7 @@ export interface Resource extends Annotated { mimeType?: string; /** - * The size of the resource in bytes before encoding or tokenization, if known. + * 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. */