diff --git a/docs/specification/draft/changelog.mdx b/docs/specification/draft/changelog.mdx index d09e798b8..28ab318fa 100644 --- a/docs/specification/draft/changelog.mdx +++ b/docs/specification/draft/changelog.mdx @@ -8,7 +8,7 @@ the previous revision, [2025-03-26](/specification/2025-03-26). ## Major changes 1. Removed support for JSON-RPC **[batching](https://www.jsonrpc.org/specification#batch)** - (PR [#416](https://github.com/modelcontextprotocol/specification/pull/416)) + (PR [#416](https://github.com/modelcontextprotocol/specification/pull/416)) 2. Added support for [structured tool output](https://modelcontextprotocol.io/specification/draft/server/tools#structured-content) (PR [#371](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/371)) 3. Classified MCP servers as [OAuth Resource Servers](https://modelcontextprotocol.io/specification/draft/basic/authorization#2-3-authorization-server-discovery), adding protected resource metadata to discover the corresponding Authorization server. (PR [#338](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/338)) @@ -18,6 +18,9 @@ the previous revision, [2025-03-26](/specification/2025-03-26). ## Other schema changes +- PromptMessage and SamplingMessage now contain Arrays of content. +- TODO + ## Full changelog For a complete list of all changes that have been made since the last protocol revision, diff --git a/docs/specification/draft/client/sampling.mdx b/docs/specification/draft/client/sampling.mdx index 9db8d4ab9..76b855247 100644 --- a/docs/specification/draft/client/sampling.mdx +++ b/docs/specification/draft/client/sampling.mdx @@ -29,7 +29,7 @@ Applications **SHOULD**: - Provide UI that makes it easy and intuitive to review sampling requests - Allow users to view and edit prompts before sending - Present generated responses for review before delivery - + ## Capabilities @@ -90,10 +90,12 @@ To request a language model generation, servers send a `sampling/createMessage` "id": 1, "result": { "role": "assistant", - "content": { - "type": "text", - "text": "The capital of France is Paris." - }, + "content": [ + { + "type": "text", + "text": "The capital of France is Paris." + } + ], "model": "claude-3-sonnet-20240307", "stopReason": "endTurn" } diff --git a/docs/specification/draft/server/prompts.mdx b/docs/specification/draft/server/prompts.mdx index 43949b981..199b3f1bf 100644 --- a/docs/specification/draft/server/prompts.mdx +++ b/docs/specification/draft/server/prompts.mdx @@ -120,10 +120,12 @@ auto-completed through [the completion API](/specification/draft/server/utilitie "messages": [ { "role": "user", - "content": { - "type": "text", - "text": "Please review this Python code:\ndef hello():\n print('world')" - } + "content": [ + { + "type": "text", + "text": "Please review this Python code:\ndef hello():\n print('world')" + } + ] } ] } diff --git a/schema/draft/schema.json b/schema/draft/schema.json index 05552b38d..79ee4bd1d 100644 --- a/schema/draft/schema.json +++ b/schema/draft/schema.json @@ -468,17 +468,20 @@ "type": "object" }, "content": { - "anyOf": [ - { - "$ref": "#/definitions/TextContent" - }, - { - "$ref": "#/definitions/ImageContent" - }, - { - "$ref": "#/definitions/AudioContent" - } - ] + "items": { + "anyOf": [ + { + "$ref": "#/definitions/TextContent" + }, + { + "$ref": "#/definitions/ImageContent" + }, + { + "$ref": "#/definitions/AudioContent" + } + ] + }, + "type": "array" }, "model": { "description": "The name of the model that generated the message.", @@ -1599,20 +1602,23 @@ "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": [ - { - "$ref": "#/definitions/TextContent" - }, - { - "$ref": "#/definitions/ImageContent" - }, - { - "$ref": "#/definitions/AudioContent" - }, - { - "$ref": "#/definitions/EmbeddedResource" - } - ] + "items": { + "anyOf": [ + { + "$ref": "#/definitions/TextContent" + }, + { + "$ref": "#/definitions/ImageContent" + }, + { + "$ref": "#/definitions/AudioContent" + }, + { + "$ref": "#/definitions/EmbeddedResource" + } + ] + }, + "type": "array" }, "role": { "$ref": "#/definitions/Role" @@ -1948,17 +1954,20 @@ "description": "Describes a message issued to or received from an LLM API.", "properties": { "content": { - "anyOf": [ - { - "$ref": "#/definitions/TextContent" - }, - { - "$ref": "#/definitions/ImageContent" - }, - { - "$ref": "#/definitions/AudioContent" - } - ] + "items": { + "anyOf": [ + { + "$ref": "#/definitions/TextContent" + }, + { + "$ref": "#/definitions/ImageContent" + }, + { + "$ref": "#/definitions/AudioContent" + } + ] + }, + "type": "array" }, "role": { "$ref": "#/definitions/Role" @@ -2279,7 +2288,7 @@ "type": "string" }, "outputSchema": { - "description": "An optional JSON Schema object defining the structure of the tool's output returned in \nthe structuredContent field of a CallToolResult.", + "description": "An optional JSON Schema object defining the structure of the tool's output returned in\nthe structuredContent field of a CallToolResult.", "properties": { "properties": { "additionalProperties": { diff --git a/schema/draft/schema.ts b/schema/draft/schema.ts index 0852bad4b..701bcd226 100644 --- a/schema/draft/schema.ts +++ b/schema/draft/schema.ts @@ -646,7 +646,7 @@ export type Role = "user" | "assistant"; */ export interface PromptMessage { role: Role; - content: TextContent | ImageContent | AudioContent | EmbeddedResource; + content: (TextContent | ImageContent | AudioContent | EmbeddedResource)[]; } /** @@ -705,7 +705,7 @@ export interface CallToolResult extends Result { * Whether the tool call ended in an error. * * If not set, this is assumed to be false (the call was successful). - * + * * Any errors that originate from the tool SHOULD be reported inside the result * object, with `isError` set to true, _not_ as an MCP protocol-level error * response. Otherwise, the LLM would not be able to see that an error occurred @@ -816,7 +816,7 @@ export interface Tool { }; /** - * An optional JSON Schema object defining the structure of the tool's output returned in + * An optional JSON Schema object defining the structure of the tool's output returned in * the structuredContent field of a CallToolResult. */ outputSchema?: { @@ -937,7 +937,7 @@ export interface CreateMessageResult extends Result, SamplingMessage { */ export interface SamplingMessage { role: Role; - content: TextContent | ImageContent | AudioContent; + content: (TextContent | ImageContent | AudioContent)[]; } /**