UNPKG

@modelcontextprotocol/sdk

Version:

Model Context Protocol implementation for TypeScript

1,123 lines (1,122 loc) 359 kB
import * as z from 'zod/v4'; import { AuthInfo } from './server/auth/types.js'; export declare const LATEST_PROTOCOL_VERSION = "2025-11-25"; export declare const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = "2025-03-26"; export declare const SUPPORTED_PROTOCOL_VERSIONS: string[]; export declare const RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task"; export declare const JSONRPC_VERSION = "2.0"; /** * Utility types */ type ExpandRecursively<T> = T extends object ? (T extends infer O ? { [K in keyof O]: ExpandRecursively<O[K]>; } : never) : T; /** * A progress token, used to associate progress notifications with the original request. */ export declare const ProgressTokenSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>; /** * An opaque token used to represent a cursor for pagination. */ export declare const CursorSchema: z.ZodString; /** * Task creation parameters, used to ask that the server create a task to represent a request. */ export declare const TaskCreationParamsSchema: z.ZodObject<{ /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up. */ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>; /** * Time in milliseconds to wait between task status requests. */ pollInterval: z.ZodOptional<z.ZodNumber>; }, z.core.$loose>; /** * Task association metadata, used to signal which task a message originated from. */ export declare const RelatedTaskMetadataSchema: z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>; declare const RequestMetaSchema: z.ZodObject<{ /** * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. */ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>; /** * If specified, this request is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>; /** * Common params for any request. */ declare const BaseRequestParamsSchema: z.ZodObject<{ /** * If specified, the caller is requesting that the receiver create a task to represent the request. * Task creation parameters are now at the top level instead of in _meta. */ task: z.ZodOptional<z.ZodObject<{ /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up. */ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>; /** * Time in milliseconds to wait between task status requests. */ pollInterval: z.ZodOptional<z.ZodNumber>; }, z.core.$loose>>; /** * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. */ _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. */ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>; /** * If specified, this request is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>; export declare const RequestSchema: z.ZodObject<{ method: z.ZodString; params: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting that the receiver create a task to represent the request. * Task creation parameters are now at the top level instead of in _meta. */ task: z.ZodOptional<z.ZodObject<{ /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up. */ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>; /** * Time in milliseconds to wait between task status requests. */ pollInterval: z.ZodOptional<z.ZodNumber>; }, z.core.$loose>>; /** * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. */ _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. */ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>; /** * If specified, this request is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$strip>; declare const NotificationsParamsSchema: z.ZodObject<{ /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ _meta: z.ZodOptional<z.ZodObject<{ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>; export declare const NotificationSchema: z.ZodObject<{ method: z.ZodString; params: z.ZodOptional<z.ZodObject<{ /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ _meta: z.ZodOptional<z.ZodObject<{ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$strip>; export declare const ResultSchema: z.ZodObject<{ /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, this result is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>; /** * A uniquely identifying ID for a request in JSON-RPC. */ export declare const RequestIdSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>; /** * A request that expects a response. */ export declare const JSONRPCRequestSchema: z.ZodObject<{ method: z.ZodString; params: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting that the receiver create a task to represent the request. * Task creation parameters are now at the top level instead of in _meta. */ task: z.ZodOptional<z.ZodObject<{ /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up. */ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>; /** * Time in milliseconds to wait between task status requests. */ pollInterval: z.ZodOptional<z.ZodNumber>; }, z.core.$loose>>; /** * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. */ _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. */ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>; /** * If specified, this request is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; jsonrpc: z.ZodLiteral<"2.0">; id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>; }, z.core.$strict>; export declare const isJSONRPCRequest: (value: unknown) => value is JSONRPCRequest; /** * A notification which does not expect a response. */ export declare const JSONRPCNotificationSchema: z.ZodObject<{ method: z.ZodString; params: z.ZodOptional<z.ZodObject<{ /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ _meta: z.ZodOptional<z.ZodObject<{ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; jsonrpc: z.ZodLiteral<"2.0">; }, z.core.$strict>; export declare const isJSONRPCNotification: (value: unknown) => value is JSONRPCNotification; /** * A successful (non-error) response to a request. */ export declare const JSONRPCResponseSchema: z.ZodObject<{ jsonrpc: z.ZodLiteral<"2.0">; id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>; result: z.ZodObject<{ /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, this result is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>; }, z.core.$strict>; export declare const isJSONRPCResponse: (value: unknown) => value is JSONRPCResponse; /** * Error codes defined by the JSON-RPC specification. */ export declare enum ErrorCode { ConnectionClosed = -32000, RequestTimeout = -32001, ParseError = -32700, InvalidRequest = -32600, MethodNotFound = -32601, InvalidParams = -32602, InternalError = -32603, UrlElicitationRequired = -32042 } /** * A response to a request that indicates an error occurred. */ export declare const JSONRPCErrorSchema: z.ZodObject<{ jsonrpc: z.ZodLiteral<"2.0">; id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>; error: z.ZodObject<{ code: z.ZodNumber; message: z.ZodString; data: z.ZodOptional<z.ZodUnknown>; }, z.core.$strip>; }, z.core.$strict>; export declare const isJSONRPCError: (value: unknown) => value is JSONRPCError; export declare const JSONRPCMessageSchema: z.ZodUnion<readonly [z.ZodObject<{ method: z.ZodString; params: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting that the receiver create a task to represent the request. * Task creation parameters are now at the top level instead of in _meta. */ task: z.ZodOptional<z.ZodObject<{ /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up. */ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>; /** * Time in milliseconds to wait between task status requests. */ pollInterval: z.ZodOptional<z.ZodNumber>; }, z.core.$loose>>; /** * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. */ _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. */ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>; /** * If specified, this request is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; jsonrpc: z.ZodLiteral<"2.0">; id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>; }, z.core.$strict>, z.ZodObject<{ method: z.ZodString; params: z.ZodOptional<z.ZodObject<{ /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ _meta: z.ZodOptional<z.ZodObject<{ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; jsonrpc: z.ZodLiteral<"2.0">; }, z.core.$strict>, z.ZodObject<{ jsonrpc: z.ZodLiteral<"2.0">; id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>; result: z.ZodObject<{ /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, this result is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>; }, z.core.$strict>, z.ZodObject<{ jsonrpc: z.ZodLiteral<"2.0">; id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>; error: z.ZodObject<{ code: z.ZodNumber; message: z.ZodString; data: z.ZodOptional<z.ZodUnknown>; }, z.core.$strip>; }, z.core.$strict>]>; /** * A response that indicates success but carries no data. */ export declare const EmptyResultSchema: z.ZodObject<{ /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, this result is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$strict>; export declare const CancelledNotificationParamsSchema: z.ZodObject<{ _meta: z.ZodOptional<z.ZodObject<{ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; requestId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>; reason: z.ZodOptional<z.ZodString>; }, z.core.$loose>; /** * This notification can be sent by either side to indicate that it is cancelling a previously-issued request. * * The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished. * * This notification indicates that the result will be unused, so any associated processing SHOULD cease. * * A client MUST NOT attempt to cancel its `initialize` request. */ export declare const CancelledNotificationSchema: z.ZodObject<{ method: z.ZodLiteral<"notifications/cancelled">; params: z.ZodObject<{ _meta: z.ZodOptional<z.ZodObject<{ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; requestId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>; reason: z.ZodOptional<z.ZodString>; }, z.core.$loose>; }, z.core.$strip>; /** * Icon schema for use in tools, prompts, resources, and implementations. */ export declare const IconSchema: z.ZodObject<{ src: z.ZodString; mimeType: z.ZodOptional<z.ZodString>; sizes: z.ZodOptional<z.ZodArray<z.ZodString>>; }, z.core.$strip>; /** * Base schema to add `icons` property. * */ export declare const IconsSchema: z.ZodObject<{ icons: z.ZodOptional<z.ZodArray<z.ZodObject<{ src: z.ZodString; mimeType: z.ZodOptional<z.ZodString>; sizes: z.ZodOptional<z.ZodArray<z.ZodString>>; }, z.core.$strip>>>; }, z.core.$strip>; /** * Base metadata interface for common properties across resources, tools, prompts, and implementations. */ export declare const BaseMetadataSchema: z.ZodObject<{ name: z.ZodString; title: z.ZodOptional<z.ZodString>; }, z.core.$strip>; /** * Describes the name and version of an MCP implementation. */ export declare const ImplementationSchema: z.ZodObject<{ version: z.ZodString; websiteUrl: z.ZodOptional<z.ZodString>; icons: z.ZodOptional<z.ZodArray<z.ZodObject<{ src: z.ZodString; mimeType: z.ZodOptional<z.ZodString>; sizes: z.ZodOptional<z.ZodArray<z.ZodString>>; }, z.core.$strip>>>; name: z.ZodString; title: z.ZodOptional<z.ZodString>; }, z.core.$strip>; /** * Task capabilities for clients, indicating which request types support task creation. */ export declare const ClientTasksCapabilitySchema: z.ZodObject<{ list: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; cancel: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; requests: z.ZodOptional<z.ZodObject<{ sampling: z.ZodOptional<z.ZodObject<{ createMessage: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; }, z.core.$loose>>; elicitation: z.ZodOptional<z.ZodObject<{ create: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>; /** * Task capabilities for servers, indicating which request types support task creation. */ export declare const ServerTasksCapabilitySchema: z.ZodObject<{ list: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; cancel: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; requests: z.ZodOptional<z.ZodObject<{ tools: z.ZodOptional<z.ZodObject<{ call: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>; /** * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities. */ export declare const ClientCapabilitiesSchema: z.ZodObject<{ experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodCustom<object, object>>>; sampling: z.ZodOptional<z.ZodObject<{ context: z.ZodOptional<z.ZodCustom<object, object>>; tools: z.ZodOptional<z.ZodCustom<object, object>>; }, z.core.$strip>>; elicitation: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodIntersection<z.ZodObject<{ form: z.ZodOptional<z.ZodIntersection<z.ZodObject<{ applyDefaults: z.ZodOptional<z.ZodBoolean>; }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodUnknown>>>; url: z.ZodOptional<z.ZodCustom<object, object>>; }, z.core.$strip>, z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>>; roots: z.ZodOptional<z.ZodObject<{ listChanged: z.ZodOptional<z.ZodBoolean>; }, z.core.$strip>>; tasks: z.ZodOptional<z.ZodObject<{ list: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; cancel: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; requests: z.ZodOptional<z.ZodObject<{ sampling: z.ZodOptional<z.ZodObject<{ createMessage: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; }, z.core.$loose>>; elicitation: z.ZodOptional<z.ZodObject<{ create: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$strip>; export declare const InitializeRequestParamsSchema: z.ZodObject<{ task: z.ZodOptional<z.ZodObject<{ /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up. */ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>; /** * Time in milliseconds to wait between task status requests. */ pollInterval: z.ZodOptional<z.ZodNumber>; }, z.core.$loose>>; _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. */ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>; /** * If specified, this request is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; protocolVersion: z.ZodString; capabilities: z.ZodObject<{ experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodCustom<object, object>>>; sampling: z.ZodOptional<z.ZodObject<{ context: z.ZodOptional<z.ZodCustom<object, object>>; tools: z.ZodOptional<z.ZodCustom<object, object>>; }, z.core.$strip>>; elicitation: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodIntersection<z.ZodObject<{ form: z.ZodOptional<z.ZodIntersection<z.ZodObject<{ applyDefaults: z.ZodOptional<z.ZodBoolean>; }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodUnknown>>>; url: z.ZodOptional<z.ZodCustom<object, object>>; }, z.core.$strip>, z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>>; roots: z.ZodOptional<z.ZodObject<{ listChanged: z.ZodOptional<z.ZodBoolean>; }, z.core.$strip>>; tasks: z.ZodOptional<z.ZodObject<{ list: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; cancel: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; requests: z.ZodOptional<z.ZodObject<{ sampling: z.ZodOptional<z.ZodObject<{ createMessage: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; }, z.core.$loose>>; elicitation: z.ZodOptional<z.ZodObject<{ create: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$strip>; clientInfo: z.ZodObject<{ version: z.ZodString; websiteUrl: z.ZodOptional<z.ZodString>; icons: z.ZodOptional<z.ZodArray<z.ZodObject<{ src: z.ZodString; mimeType: z.ZodOptional<z.ZodString>; sizes: z.ZodOptional<z.ZodArray<z.ZodString>>; }, z.core.$strip>>>; name: z.ZodString; title: z.ZodOptional<z.ZodString>; }, z.core.$strip>; }, z.core.$loose>; /** * This request is sent from the client to the server when it first connects, asking it to begin initialization. */ export declare const InitializeRequestSchema: z.ZodObject<{ method: z.ZodLiteral<"initialize">; params: z.ZodObject<{ task: z.ZodOptional<z.ZodObject<{ /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up. */ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>; /** * Time in milliseconds to wait between task status requests. */ pollInterval: z.ZodOptional<z.ZodNumber>; }, z.core.$loose>>; _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. */ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>; /** * If specified, this request is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; protocolVersion: z.ZodString; capabilities: z.ZodObject<{ experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodCustom<object, object>>>; sampling: z.ZodOptional<z.ZodObject<{ context: z.ZodOptional<z.ZodCustom<object, object>>; tools: z.ZodOptional<z.ZodCustom<object, object>>; }, z.core.$strip>>; elicitation: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodIntersection<z.ZodObject<{ form: z.ZodOptional<z.ZodIntersection<z.ZodObject<{ applyDefaults: z.ZodOptional<z.ZodBoolean>; }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodUnknown>>>; url: z.ZodOptional<z.ZodCustom<object, object>>; }, z.core.$strip>, z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>>; roots: z.ZodOptional<z.ZodObject<{ listChanged: z.ZodOptional<z.ZodBoolean>; }, z.core.$strip>>; tasks: z.ZodOptional<z.ZodObject<{ list: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; cancel: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; requests: z.ZodOptional<z.ZodObject<{ sampling: z.ZodOptional<z.ZodObject<{ createMessage: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; }, z.core.$loose>>; elicitation: z.ZodOptional<z.ZodObject<{ create: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$strip>; clientInfo: z.ZodObject<{ version: z.ZodString; websiteUrl: z.ZodOptional<z.ZodString>; icons: z.ZodOptional<z.ZodArray<z.ZodObject<{ src: z.ZodString; mimeType: z.ZodOptional<z.ZodString>; sizes: z.ZodOptional<z.ZodArray<z.ZodString>>; }, z.core.$strip>>>; name: z.ZodString; title: z.ZodOptional<z.ZodString>; }, z.core.$strip>; }, z.core.$loose>; }, z.core.$strip>; export declare const isInitializeRequest: (value: unknown) => value is InitializeRequest; /** * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities. */ export declare const ServerCapabilitiesSchema: z.ZodObject<{ experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodCustom<object, object>>>; logging: z.ZodOptional<z.ZodCustom<object, object>>; completions: z.ZodOptional<z.ZodCustom<object, object>>; prompts: z.ZodOptional<z.ZodObject<{ listChanged: z.ZodOptional<z.ZodBoolean>; }, z.core.$strip>>; resources: z.ZodOptional<z.ZodObject<{ subscribe: z.ZodOptional<z.ZodBoolean>; listChanged: z.ZodOptional<z.ZodBoolean>; }, z.core.$strip>>; tools: z.ZodOptional<z.ZodObject<{ listChanged: z.ZodOptional<z.ZodBoolean>; }, z.core.$strip>>; tasks: z.ZodOptional<z.ZodObject<{ list: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; cancel: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; requests: z.ZodOptional<z.ZodObject<{ tools: z.ZodOptional<z.ZodObject<{ call: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>; /** * After receiving an initialize request from the client, the server sends this response. */ export declare const InitializeResultSchema: z.ZodObject<{ _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, this result is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; protocolVersion: z.ZodString; capabilities: z.ZodObject<{ experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodCustom<object, object>>>; logging: z.ZodOptional<z.ZodCustom<object, object>>; completions: z.ZodOptional<z.ZodCustom<object, object>>; prompts: z.ZodOptional<z.ZodObject<{ listChanged: z.ZodOptional<z.ZodBoolean>; }, z.core.$strip>>; resources: z.ZodOptional<z.ZodObject<{ subscribe: z.ZodOptional<z.ZodBoolean>; listChanged: z.ZodOptional<z.ZodBoolean>; }, z.core.$strip>>; tools: z.ZodOptional<z.ZodObject<{ listChanged: z.ZodOptional<z.ZodBoolean>; }, z.core.$strip>>; tasks: z.ZodOptional<z.ZodObject<{ list: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; cancel: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; requests: z.ZodOptional<z.ZodObject<{ tools: z.ZodOptional<z.ZodObject<{ call: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>; serverInfo: z.ZodObject<{ version: z.ZodString; websiteUrl: z.ZodOptional<z.ZodString>; icons: z.ZodOptional<z.ZodArray<z.ZodObject<{ src: z.ZodString; mimeType: z.ZodOptional<z.ZodString>; sizes: z.ZodOptional<z.ZodArray<z.ZodString>>; }, z.core.$strip>>>; name: z.ZodString; title: z.ZodOptional<z.ZodString>; }, z.core.$strip>; instructions: z.ZodOptional<z.ZodString>; }, z.core.$loose>; /** * This notification is sent from the client to the server after initialization has finished. */ export declare const InitializedNotificationSchema: z.ZodObject<{ params: z.ZodOptional<z.ZodObject<{ /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ _meta: z.ZodOptional<z.ZodObject<{ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; method: z.ZodLiteral<"notifications/initialized">; }, z.core.$strip>; export declare const isInitializedNotification: (value: unknown) => value is InitializedNotification; /** * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected. */ export declare const PingRequestSchema: z.ZodObject<{ params: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting that the receiver create a task to represent the request. * Task creation parameters are now at the top level instead of in _meta. */ task: z.ZodOptional<z.ZodObject<{ /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up. */ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>; /** * Time in milliseconds to wait between task status requests. */ pollInterval: z.ZodOptional<z.ZodNumber>; }, z.core.$loose>>; /** * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. */ _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. */ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>; /** * If specified, this request is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$loose>>; method: z.ZodLiteral<"ping">; }, z.core.$strip>; export declare const ProgressSchema: z.ZodObject<{ progress: z.ZodNumber; total: z.ZodOptional<z.ZodNumber>; message: z.ZodOptional<z.ZodString>; }, z.core.$strip>; export declare const ProgressNotificationParamsSchema: z.ZodObject<{ progressToken: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>; progress: z.ZodNumber; total: z.ZodOptional<z.ZodNumber>; message: z.ZodOptional<z.ZodString>; _meta: z.ZodOptional<z.ZodObject<{ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$strip>; /** * An out-of-band notification used to inform the receiver of a progress update for a long-running request. * * @category notifications/progress */ export declare const ProgressNotificationSchema: z.ZodObject<{ method: z.ZodLiteral<"notifications/progress">; params: z.ZodObject<{ progressToken: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>; progress: z.ZodNumber; total: z.ZodOptional<z.ZodNumber>; message: z.ZodOptional<z.ZodString>; _meta: z.ZodOptional<z.ZodObject<{ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; }, z.core.$strip>; }, z.core.$strip>; export declare const PaginatedRequestParamsSchema: z.ZodObject<{ task: z.ZodOptional<z.ZodObject<{ /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up. */ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>; /** * Time in milliseconds to wait between task status requests. */ pollInterval: z.ZodOptional<z.ZodNumber>; }, z.core.$loose>>; _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. */ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>; /** * If specified, this request is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; cursor: z.ZodOptional<z.ZodString>; }, z.core.$loose>; export declare const PaginatedRequestSchema: z.ZodObject<{ method: z.ZodString; params: z.ZodOptional<z.ZodObject<{ task: z.ZodOptional<z.ZodObject<{ /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up. */ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>; /** * Time in milliseconds to wait between task status requests. */ pollInterval: z.ZodOptional<z.ZodNumber>; }, z.core.$loose>>; _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. */ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>; /** * If specified, this request is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; cursor: z.ZodOptional<z.ZodString>; }, z.core.$loose>>; }, z.core.$strip>; export declare const PaginatedResultSchema: z.ZodObject<{ _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, this result is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; nextCursor: z.ZodOptional<z.ZodString>; }, z.core.$loose>; /** * A pollable state object associated with a request. */ export declare const TaskSchema: z.ZodObject<{ taskId: z.ZodString; status: z.ZodEnum<{ working: "working"; input_required: "input_required"; completed: "completed"; failed: "failed"; cancelled: "cancelled"; }>; ttl: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>; createdAt: z.ZodString; lastUpdatedAt: z.ZodString; pollInterval: z.ZodOptional<z.ZodNumber>; statusMessage: z.ZodOptional<z.ZodString>; }, z.core.$strip>; /** * Result returned when a task is created, containing the task data wrapped in a task field. */ export declare const CreateTaskResultSchema: z.ZodObject<{ _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, this result is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; task: z.ZodObject<{ taskId: z.ZodString; status: z.ZodEnum<{ working: "working"; input_required: "input_required"; completed: "completed"; failed: "failed"; cancelled: "cancelled"; }>; ttl: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>; createdAt: z.ZodString; lastUpdatedAt: z.ZodString; pollInterval: z.ZodOptional<z.ZodNumber>; statusMessage: z.ZodOptional<z.ZodString>; }, z.core.$strip>; }, z.core.$loose>; /** * Parameters for task status notification. */ export declare const TaskStatusNotificationParamsSchema: z.ZodObject<{ _meta: z.ZodOptional<z.ZodObject<{ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; taskId: z.ZodString; status: z.ZodEnum<{ working: "working"; input_required: "input_required"; completed: "completed"; failed: "failed"; cancelled: "cancelled"; }>; ttl: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>; createdAt: z.ZodString; lastUpdatedAt: z.ZodString; pollInterval: z.ZodOptional<z.ZodNumber>; statusMessage: z.ZodOptional<z.ZodString>; }, z.core.$strip>; /** * A notification sent when a task's status changes. */ export declare const TaskStatusNotificationSchema: z.ZodObject<{ method: z.ZodLiteral<"notifications/tasks/status">; params: z.ZodObject<{ _meta: z.ZodOptional<z.ZodObject<{ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; taskId: z.ZodString; status: z.ZodEnum<{ working: "working"; input_required: "input_required"; completed: "completed"; failed: "failed"; cancelled: "cancelled"; }>; ttl: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>; createdAt: z.ZodString; lastUpdatedAt: z.ZodString; pollInterval: z.ZodOptional<z.ZodNumber>; statusMessage: z.ZodOptional<z.ZodString>; }, z.core.$strip>; }, z.core.$strip>; /** * A request to get the state of a specific task. */ export declare const GetTaskRequestSchema: z.ZodObject<{ method: z.ZodLiteral<"tasks/get">; params: z.ZodObject<{ task: z.ZodOptional<z.ZodObject<{ /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up. */ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>; /** * Time in milliseconds to wait between task status requests. */ pollInterval: z.ZodOptional<z.ZodNumber>; }, z.core.$loose>>; _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. */ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>; /** * If specified, this request is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; taskId: z.ZodString; }, z.core.$loose>; }, z.core.$strip>; /** * The response to a tasks/get request. */ export declare const GetTaskResultSchema: z.ZodObject<{ _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, this result is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; taskId: z.ZodString; status: z.ZodEnum<{ working: "working"; input_required: "input_required"; completed: "completed"; failed: "failed"; cancelled: "cancelled"; }>; ttl: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>; createdAt: z.ZodString; lastUpdatedAt: z.ZodString; pollInterval: z.ZodOptional<z.ZodNumber>; statusMessage: z.ZodOptional<z.ZodString>; }, z.core.$strip>; /** * A request to get the result of a specific task. */ export declare const GetTaskPayloadRequestSchema: z.ZodObject<{ method: z.ZodLiteral<"tasks/result">; params: z.ZodObject<{ task: z.ZodOptional<z.ZodObject<{ /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up. */ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>; /** * Time in milliseconds to wait between task status requests. */ pollInterval: z.ZodOptional<z.ZodNumber>; }, z.core.$loose>>; _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. */ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>; /** * If specified, this request is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; taskId: z.ZodString; }, z.core.$loose>; }, z.core.$strip>; /** * A request to list tasks. */ export declare const ListTasksRequestSchema: z.ZodObject<{ params: z.ZodOptional<z.ZodObject<{ task: z.ZodOptional<z.ZodObject<{ /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up. */ ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>; /** * Time in milliseconds to wait between task status requests. */ pollInterval: z.ZodOptional<z.ZodNumber>; }, z.core.$loose>>; _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. */ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>; /** * If specified, this request is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; cursor: z.ZodOptional<z.ZodString>; }, z.core.$loose>>; method: z.ZodLiteral<"tasks/list">; }, z.core.$strip>; /** * The response to a tasks/list request. */ export declare const ListTasksResultSchema: z.ZodObject<{ _meta: z.ZodOptional<z.ZodObject<{ /** * If specified, this result is related to the provided task. */ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{ taskId: z.ZodString; }, z.core.$loose>>; }, z.core.$loose>>; nextCursor: z.ZodOptional<z.ZodString>; tasks: z.ZodArray<z.ZodObject<{ taskId: z.ZodString; status: z.ZodEnum<{ working: "working"; input_required: "input_required"; completed: "completed"; failed: "failed"; cancelled: "cancelled"; }>; ttl: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>; createdAt: z.ZodString; lastUpdatedAt: z.ZodString; pollInterval: z.ZodOptional<z.ZodNumber>; statusMessage: z.ZodOptional<z.ZodString>; }, z.core.$strip>>; }, z.core.$loose>; /** * A request to cancel a specific task. */ export declare const CancelTaskRequestSchema: z.ZodObject<{ method: z.ZodLiteral<"tasks/cancel">; params: z.ZodObject<{ task: z.ZodOptional<z.ZodObject<{ /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up.