From 41b43c44a661402274eacdd051660d0b055b943c Mon Sep 17 00:00:00 2001 From: Justin Spahr-Summers Date: Tue, 5 Nov 2024 14:44:43 +0000 Subject: [PATCH 1/2] Make clearer that resources embedded into prompts include text or binary --- schema/schema.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/schema/schema.ts b/schema/schema.ts index fce4b4c61..6f3dd3710 100644 --- a/schema/schema.ts +++ b/schema/schema.ts @@ -558,11 +558,11 @@ export interface PromptArgument { * Describes a message returned as part of a prompt. * * This is similar to `SamplingMessage`, but also supports the embedding of - * resource contents from the MCP server. + * resources from the MCP server. */ export interface PromptMessage { role: "user" | "assistant"; - content: TextContent | ImageContent | PromptResourceContents; + content: TextContent | ImageContent | PromptEmbeddedResource; } /** @@ -571,8 +571,9 @@ export interface PromptMessage { * It is up to the client how best to render embedded resources for the benefit * of the LLM and/or the user. */ -export interface PromptResourceContents extends ResourceContents { +export interface PromptEmbeddedResource { type: "resource"; + resource: TextResourceContents | BlobResourceContents; } /** From c0c508075b42768a05deb787a94f2cede46242b7 Mon Sep 17 00:00:00 2001 From: Justin Spahr-Summers Date: Tue, 5 Nov 2024 14:46:22 +0000 Subject: [PATCH 2/2] Generate JSON schema --- schema/schema.json | 51 +++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/schema/schema.json b/schema/schema.json index b185d43a4..a5327167f 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -1171,6 +1171,30 @@ ], "type": "object" }, + "PromptEmbeddedResource": { + "description": "The contents of a resource, embedded into a prompt.\n\nIt is up to the client how best to render embedded resources for the benefit\nof the LLM and/or the user.", + "properties": { + "resource": { + "anyOf": [ + { + "$ref": "#/definitions/TextResourceContents" + }, + { + "$ref": "#/definitions/BlobResourceContents" + } + ] + }, + "type": { + "const": "resource", + "type": "string" + } + }, + "required": [ + "resource", + "type" + ], + "type": "object" + }, "PromptListChangedNotification": { "description": "An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.", "properties": { @@ -1196,7 +1220,7 @@ "type": "object" }, "PromptMessage": { - "description": "Describes a message returned as part of a prompt.\n\nThis is similar to `SamplingMessage`, but also supports the embedding of\nresource contents from the MCP server.", + "description": "Describes a message returned as part of a prompt.\n\nThis is similar to `SamplingMessage`, but also supports the embedding of\nresources from the MCP server.", "properties": { "content": { "anyOf": [ @@ -1207,7 +1231,7 @@ "$ref": "#/definitions/ImageContent" }, { - "$ref": "#/definitions/PromptResourceContents" + "$ref": "#/definitions/PromptEmbeddedResource" } ] }, @@ -1243,29 +1267,6 @@ ], "type": "object" }, - "PromptResourceContents": { - "description": "The contents of a resource, embedded into a prompt.\n\nIt is up to the client how best to render embedded resources for the benefit\nof the LLM and/or the user.", - "properties": { - "mimeType": { - "description": "The MIME type of this resource, if known.", - "type": "string" - }, - "type": { - "const": "resource", - "type": "string" - }, - "uri": { - "description": "The URI of this resource.", - "format": "uri", - "type": "string" - } - }, - "required": [ - "type", - "uri" - ], - "type": "object" - }, "ReadResourceRequest": { "description": "Sent from the client to the server, to read a specific resource URI.", "properties": {