@modelcontextprotocol/sdk
Advanced tools
Comparing version 1.0.2 to 1.0.3
import { Protocol, ProtocolOptions, RequestOptions } from "../shared/protocol.js"; | ||
import { Transport } from "../shared/transport.js"; | ||
import { CallToolRequest, CallToolResultSchema, ClientCapabilities, ClientNotification, ClientRequest, ClientResult, CompleteRequest, GetPromptRequest, Implementation, ListPromptsRequest, ListResourcesRequest, ListResourceTemplatesRequest, ListToolsRequest, LoggingLevel, Notification, ReadResourceRequest, Request, Result, ServerCapabilities, SubscribeRequest, UnsubscribeRequest } from "../types.js"; | ||
import { CallToolRequest, CallToolResultSchema, ClientCapabilities, ClientNotification, ClientRequest, ClientResult, CompatibilityCallToolResultSchema, CompleteRequest, GetPromptRequest, Implementation, ListPromptsRequest, ListResourcesRequest, ListResourceTemplatesRequest, ListToolsRequest, LoggingLevel, Notification, ReadResourceRequest, Request, Result, ServerCapabilities, SubscribeRequest, UnsubscribeRequest } from "../types.js"; | ||
export type ClientOptions = ProtocolOptions & { | ||
@@ -595,3 +595,3 @@ /** | ||
}>; | ||
callTool(params: CallToolRequest["params"], resultSchema: typeof CallToolResultSchema, options?: RequestOptions): Promise<import("zod").objectOutputType<import("zod").objectUtil.extendShape<{ | ||
callTool(params: CallToolRequest["params"], resultSchema?: typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema, options?: RequestOptions): Promise<import("zod").objectOutputType<import("zod").objectUtil.extendShape<{ | ||
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>; | ||
@@ -721,2 +721,6 @@ }, { | ||
isError: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>; | ||
}>, import("zod").ZodTypeAny, "passthrough"> | import("zod").objectOutputType<import("zod").objectUtil.extendShape<{ | ||
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>; | ||
}, { | ||
toolResult: import("zod").ZodUnknown; | ||
}>, import("zod").ZodTypeAny, "passthrough">>; | ||
@@ -723,0 +727,0 @@ listTools(params?: ListToolsRequest["params"], options?: RequestOptions): Promise<import("zod").objectOutputType<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<{ |
import { Protocol, } from "../shared/protocol.js"; | ||
import { CompleteResultSchema, EmptyResultSchema, GetPromptResultSchema, InitializeResultSchema, LATEST_PROTOCOL_VERSION, ListPromptsResultSchema, ListResourcesResultSchema, ListResourceTemplatesResultSchema, ListToolsResultSchema, ReadResourceResultSchema, SUPPORTED_PROTOCOL_VERSIONS, } from "../types.js"; | ||
import { CallToolResultSchema, CompleteResultSchema, EmptyResultSchema, GetPromptResultSchema, InitializeResultSchema, LATEST_PROTOCOL_VERSION, ListPromptsResultSchema, ListResourcesResultSchema, ListResourceTemplatesResultSchema, ListToolsResultSchema, ReadResourceResultSchema, SUPPORTED_PROTOCOL_VERSIONS, } from "../types.js"; | ||
/** | ||
@@ -196,3 +196,3 @@ * An MCP client on top of a pluggable transport. | ||
} | ||
async callTool(params, resultSchema, options) { | ||
async callTool(params, resultSchema = CallToolResultSchema, options) { | ||
return this.request({ method: "tools/call", params }, resultSchema, options); | ||
@@ -199,0 +199,0 @@ } |
@@ -672,2 +672,8 @@ import { z } from "zod"; | ||
/** | ||
* 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. | ||
@@ -674,0 +680,0 @@ */ |
{ | ||
"name": "@modelcontextprotocol/sdk", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Model Context Protocol implementation for TypeScript", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
1660866
31808
0