Skip to content

Instantly share code, notes, and snippets.

@qrg
Created March 27, 2025 09:55
Show Gist options
  • Save qrg/56b5578133fa148764b484a9cda05237 to your computer and use it in GitHub Desktop.
Save qrg/56b5578133fa148764b484a9cda05237 to your computer and use it in GitHub Desktop.
--- schema/2024-11-05/schema.ts 2025-03-27 02:23:35
+++ schema/2025-03-26/schema.ts 2025-03-27 02:23:53
@@ -1,11 +1,27 @@
/* JSON-RPC types */
+
+/**
+ * Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.
+ */
export type JSONRPCMessage =
| JSONRPCRequest
| JSONRPCNotification
+ | JSONRPCBatchRequest
| JSONRPCResponse
- | JSONRPCError;
+ | JSONRPCError
+ | JSONRPCBatchResponse;
-export const LATEST_PROTOCOL_VERSION = "2024-11-05";
+/**
+ * A JSON-RPC batch request, as described in https://www.jsonrpc.org/specification#batch.
+ */
+export type JSONRPCBatchRequest = (JSONRPCRequest | JSONRPCNotification)[];
+
+/**
+ * A JSON-RPC batch response, as described in https://www.jsonrpc.org/specification#batch.
+ */
+export type JSONRPCBatchResponse = (JSONRPCResponse | JSONRPCError)[];
+
+export const LATEST_PROTOCOL_VERSION = "2025-03-26";
export const JSONRPC_VERSION = "2.0";
/**
@@ -167,6 +183,7 @@
protocolVersion: string;
capabilities: ServerCapabilities;
serverInfo: Implementation;
+
/**
* Instructions describing how to use the server and its features.
*
@@ -218,6 +235,10 @@
*/
logging?: object;
/**
+ * Present if the server supports argument autocompletion suggestions.
+ */
+ completions?: object;
+ /**
* Present if the server offers any prompt templates.
*/
prompts?: {
@@ -289,6 +310,10 @@
* @TJS-type number
*/
total?: number;
+ /**
+ * An optional message describing the current progress.
+ */
+ message?: string;
};
}
@@ -417,7 +442,7 @@
/**
* A known resource that the server is capable of reading.
*/
-export interface Resource extends Annotated {
+export interface Resource {
/**
* The URI of this resource.
*
@@ -445,17 +470,15 @@
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.
+ * Optional annotations for the client.
*/
- size?: number;
+ annotations?: Annotations;
}
/**
* A template description for resources available on the server.
*/
-export interface ResourceTemplate extends Annotated {
+export interface ResourceTemplate {
/**
* A URI template (according to RFC 6570) that can be used to construct resource URIs.
*
@@ -481,6 +504,11 @@
* The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.
*/
mimeType?: string;
+
+ /**
+ * Optional annotations for the client.
+ */
+ annotations?: Annotations;
}
/**
@@ -607,7 +635,7 @@
*/
export interface PromptMessage {
role: Role;
- content: TextContent | ImageContent | EmbeddedResource;
+ content: TextContent | ImageContent | AudioContent | EmbeddedResource;
}
/**
@@ -616,9 +644,14 @@
* It is up to the client how best to render embedded resources for the benefit
* of the LLM and/or the user.
*/
-export interface EmbeddedResource extends Annotated {
+export interface EmbeddedResource {
type: "resource";
resource: TextResourceContents | BlobResourceContents;
+
+ /**
+ * Optional annotations for the client.
+ */
+ annotations?: Annotations;
}
/**
@@ -656,7 +689,7 @@
* should be reported as an MCP error response.
*/
export interface CallToolResult extends Result {
- content: (TextContent | ImageContent | EmbeddedResource)[];
+ content: (TextContent | ImageContent | AudioContent | EmbeddedResource)[];
/**
* Whether the tool call ended in an error.
@@ -685,6 +718,60 @@
}
/**
+ * Additional properties describing a Tool to clients.
+ *
+ * NOTE: all properties in ToolAnnotations are **hints**.
+ * They are not guaranteed to provide a faithful description of
+ * tool behavior (including descriptive properties like `title`).
+ *
+ * Clients should never make tool use decisions based on ToolAnnotations
+ * received from untrusted servers.
+ */
+export interface ToolAnnotations {
+ /**
+ * A human-readable title for the tool.
+ */
+ title?: string;
+
+ /**
+ * If true, the tool does not modify its environment.
+ *
+ * Default: false
+ */
+ readOnlyHint?: boolean;
+
+ /**
+ * If true, the tool may perform destructive updates to its environment.
+ * If false, the tool performs only additive updates.
+ *
+ * (This property is meaningful only when `readOnlyHint == false`)
+ *
+ * Default: true
+ */
+ destructiveHint?: boolean;
+
+ /**
+ * If true, calling the tool repeatedly with the same arguments
+ * will have no additional effect on the its environment.
+ *
+ * (This property is meaningful only when `readOnlyHint == false`)
+ *
+ * Default: false
+ */
+ idempotentHint?: boolean;
+
+ /**
+ * If true, this tool may interact with an "open world" of external
+ * entities. If false, the tool's domain of interaction is closed.
+ * For example, the world of a web search tool is open, whereas that
+ * of a memory tool is not.
+ *
+ * Default: true
+ */
+ openWorldHint?: boolean;
+}
+
+/**
* Definition for a tool the client can call.
*/
export interface Tool {
@@ -692,10 +779,14 @@
* The name of the tool.
*/
name: string;
+
/**
* A human-readable description of the tool.
+ *
+ * This can be used by clients to improve the LLM's understanding of available tools. It can be thought of like a "hint" to the model.
*/
description?: string;
+
/**
* A JSON Schema object defining the expected parameters for the tool.
*/
@@ -704,6 +795,11 @@
properties?: { [key: string]: object };
required?: string[];
};
+
+ /**
+ * Optional additional tool information.
+ */
+ annotations?: ToolAnnotations;
}
/* Logging */
@@ -812,62 +908,97 @@
*/
export interface SamplingMessage {
role: Role;
- content: TextContent | ImageContent;
+ content: TextContent | ImageContent | AudioContent;
}
/**
- * Base for objects that include optional annotations for the client. The client can use annotations to inform how objects are used or displayed
+ * Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
*/
-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[];
+export interface 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.
- *
- * @TJS-type number
- * @minimum 0
- * @maximum 1
- */
- priority?: number;
- }
+ /**
+ * 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.
+ *
+ * @TJS-type number
+ * @minimum 0
+ * @maximum 1
+ */
+ priority?: number;
}
/**
* Text provided to or from an LLM.
*/
-export interface TextContent extends Annotated {
+export interface TextContent {
type: "text";
+
/**
* The text content of the message.
*/
text: string;
+
+ /**
+ * Optional annotations for the client.
+ */
+ annotations?: Annotations;
}
/**
* An image provided to or from an LLM.
*/
-export interface ImageContent extends Annotated {
+export interface ImageContent {
type: "image";
+
/**
* The base64-encoded image data.
*
* @format byte
*/
data: string;
+
/**
* The MIME type of the image. Different providers may support different image types.
+ */
+ mimeType: string;
+
+ /**
+ * Optional annotations for the client.
+ */
+ annotations?: Annotations;
+}
+
+/**
+ * Audio provided to or from an LLM.
+ */
+export interface AudioContent {
+ type: "audio";
+
+ /**
+ * The base64-encoded audio data.
+ *
+ * @format byte
+ */
+ data: string;
+
+ /**
+ * The MIME type of the audio. Different providers may support different audio types.
*/
mimeType: string;
+
+ /**
+ * Optional annotations for the client.
+ */
+ annotations?: Annotations;
}
/**
@@ -1079,7 +1210,6 @@
| GetPromptRequest
| ListPromptsRequest
| ListResourcesRequest
- | ListResourceTemplatesRequest
| ReadResourceRequest
| SubscribeRequest
| UnsubscribeRequest
@@ -1116,7 +1246,6 @@
| GetPromptResult
| ListPromptsResult
| ListResourcesResult
- | ListResourceTemplatesResult
| ReadResourceResult
| CallToolResult
| ListToolsResult;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment