From e911ece970934f614f1ab61d349e7f3ecf162140 Mon Sep 17 00:00:00 2001 From: Justin Spahr-Summers Date: Tue, 3 Dec 2024 16:03:26 +0000 Subject: [PATCH 1/4] Remove `CompatibilityCallToolResult` Resolves #82. --- src/client/index.ts | 5 +---- src/types.ts | 12 ------------ 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/client/index.ts b/src/client/index.ts index 1ad51616..afc72420 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -11,7 +11,6 @@ import { ClientNotification, ClientRequest, ClientResult, - CompatibilityCallToolResultSchema, CompleteRequest, CompleteResultSchema, EmptyResultSchema, @@ -377,9 +376,7 @@ export class Client< async callTool( params: CallToolRequest["params"], - resultSchema: - | typeof CallToolResultSchema - | typeof CompatibilityCallToolResultSchema = CallToolResultSchema, + resultSchema: typeof CallToolResultSchema, options?: RequestOptions, ) { return this.request( diff --git a/src/types.ts b/src/types.ts index 44a44d8f..5db06a5d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -752,15 +752,6 @@ export const CallToolResultSchema = ResultSchema.extend({ isError: z.boolean().default(false).optional(), }); -/** - * CallToolResultSchema extended with backwards compatibility to protocol version 2024-10-07. - */ -export const CompatibilityCallToolResultSchema = CallToolResultSchema.or( - ResultSchema.extend({ - toolResult: z.unknown(), - }), -); - /** * Used by the client to invoke a tool provided by the server. */ @@ -1195,9 +1186,6 @@ export type Tool = z.infer; export type ListToolsRequest = z.infer; export type ListToolsResult = z.infer; export type CallToolResult = z.infer; -export type CompatibilityCallToolResult = z.infer< - typeof CompatibilityCallToolResultSchema ->; export type CallToolRequest = z.infer; export type ToolListChangedNotification = z.infer< typeof ToolListChangedNotificationSchema From 45af3820fabeec456fafc3ac44a5980d0512e10a Mon Sep 17 00:00:00 2001 From: Justin Spahr-Summers Date: Wed, 4 Dec 2024 14:15:39 +0000 Subject: [PATCH 2/4] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c50a2e3d..212eaf66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@modelcontextprotocol/sdk", - "version": "1.0.1", + "version": "1.0.2", "description": "Model Context Protocol implementation for TypeScript", "license": "MIT", "author": "Anthropic, PBC (https://anthropic.com)", From 1962943b226b2370a7380ff7527c37ecde121996 Mon Sep 17 00:00:00 2001 From: Justin Spahr-Summers Date: Wed, 4 Dec 2024 17:09:31 +0000 Subject: [PATCH 3/4] Revert "Remove `CompatibilityCallToolResult`" --- src/client/index.ts | 5 ++++- src/types.ts | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/client/index.ts b/src/client/index.ts index afc72420..1ad51616 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -11,6 +11,7 @@ import { ClientNotification, ClientRequest, ClientResult, + CompatibilityCallToolResultSchema, CompleteRequest, CompleteResultSchema, EmptyResultSchema, @@ -376,7 +377,9 @@ export class Client< async callTool( params: CallToolRequest["params"], - resultSchema: typeof CallToolResultSchema, + resultSchema: + | typeof CallToolResultSchema + | typeof CompatibilityCallToolResultSchema = CallToolResultSchema, options?: RequestOptions, ) { return this.request( diff --git a/src/types.ts b/src/types.ts index 5db06a5d..44a44d8f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -752,6 +752,15 @@ export const CallToolResultSchema = ResultSchema.extend({ isError: z.boolean().default(false).optional(), }); +/** + * CallToolResultSchema extended with backwards compatibility to protocol version 2024-10-07. + */ +export const CompatibilityCallToolResultSchema = CallToolResultSchema.or( + ResultSchema.extend({ + toolResult: z.unknown(), + }), +); + /** * Used by the client to invoke a tool provided by the server. */ @@ -1186,6 +1195,9 @@ export type Tool = z.infer; export type ListToolsRequest = z.infer; export type ListToolsResult = z.infer; export type CallToolResult = z.infer; +export type CompatibilityCallToolResult = z.infer< + typeof CompatibilityCallToolResultSchema +>; export type CallToolRequest = z.infer; export type ToolListChangedNotification = z.infer< typeof ToolListChangedNotificationSchema From 620cb5cb52140d3397dcd8fb2641a5cf59c5f0ea Mon Sep 17 00:00:00 2001 From: Justin Spahr-Summers Date: Wed, 4 Dec 2024 17:19:00 +0000 Subject: [PATCH 4/4] Bump to 1.0.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 212eaf66..63fb871d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@modelcontextprotocol/sdk", - "version": "1.0.2", + "version": "1.0.3", "description": "Model Context Protocol implementation for TypeScript", "license": "MIT", "author": "Anthropic, PBC (https://anthropic.com)",