@modelcontextprotocol/sdk 1.24.3 → 1.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/auth-extensions.js +5 -9
- package/dist/cjs/client/auth-extensions.js.map +1 -1
- package/dist/cjs/client/auth.js +30 -37
- package/dist/cjs/client/auth.js.map +1 -1
- package/dist/cjs/client/index.d.ts +61 -14
- package/dist/cjs/client/index.d.ts.map +1 -1
- package/dist/cjs/client/index.js +117 -36
- package/dist/cjs/client/index.js.map +1 -1
- package/dist/cjs/client/middleware.js +3 -3
- package/dist/cjs/client/middleware.js.map +1 -1
- package/dist/cjs/client/sse.js +19 -27
- package/dist/cjs/client/sse.js.map +1 -1
- package/dist/cjs/client/stdio.js +18 -28
- package/dist/cjs/client/stdio.js.map +1 -1
- package/dist/cjs/client/streamableHttp.d.ts.map +1 -1
- package/dist/cjs/client/streamableHttp.js +39 -49
- package/dist/cjs/client/streamableHttp.js.map +1 -1
- package/dist/cjs/client/websocket.js +6 -11
- package/dist/cjs/client/websocket.js.map +1 -1
- package/dist/cjs/examples/client/elicitationUrlExample.js +4 -5
- package/dist/cjs/examples/client/elicitationUrlExample.js.map +1 -1
- package/dist/cjs/examples/client/simpleOAuthClient.js +3 -3
- package/dist/cjs/examples/client/simpleOAuthClient.js.map +1 -1
- package/dist/cjs/examples/client/simpleStreamableHttp.js +7 -9
- package/dist/cjs/examples/client/simpleStreamableHttp.js.map +1 -1
- package/dist/cjs/examples/client/simpleTaskInteractiveClient.js +1 -2
- package/dist/cjs/examples/client/simpleTaskInteractiveClient.js.map +1 -1
- package/dist/cjs/examples/server/honoWebStandardStreamableHttp.d.ts +10 -0
- package/dist/cjs/examples/server/honoWebStandardStreamableHttp.d.ts.map +1 -0
- package/dist/cjs/examples/server/honoWebStandardStreamableHttp.js +81 -0
- package/dist/cjs/examples/server/honoWebStandardStreamableHttp.js.map +1 -0
- package/dist/cjs/examples/server/jsonResponseStreamableHttp.js +10 -4
- package/dist/cjs/examples/server/jsonResponseStreamableHttp.js.map +1 -1
- package/dist/cjs/examples/server/simpleSseServer.js +6 -3
- package/dist/cjs/examples/server/simpleSseServer.js.map +1 -1
- package/dist/cjs/examples/server/simpleStatelessStreamableHttp.js +12 -6
- package/dist/cjs/examples/server/simpleStatelessStreamableHttp.js.map +1 -1
- package/dist/cjs/examples/server/simpleStreamableHttp.js +21 -11
- package/dist/cjs/examples/server/simpleStreamableHttp.js.map +1 -1
- package/dist/cjs/examples/server/simpleTaskInteractive.js +7 -11
- package/dist/cjs/examples/server/simpleTaskInteractive.js.map +1 -1
- package/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js +10 -7
- package/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
- package/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.js +1 -1
- package/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.js.map +1 -1
- package/dist/cjs/experimental/tasks/client.js +1 -2
- package/dist/cjs/experimental/tasks/client.js.map +1 -1
- package/dist/cjs/experimental/tasks/helpers.js +3 -5
- package/dist/cjs/experimental/tasks/helpers.js.map +1 -1
- package/dist/cjs/experimental/tasks/interfaces.d.ts +3 -3
- package/dist/cjs/experimental/tasks/interfaces.d.ts.map +1 -1
- package/dist/cjs/experimental/tasks/stores/in-memory.d.ts +1 -1
- package/dist/cjs/experimental/tasks/stores/in-memory.d.ts.map +1 -1
- package/dist/cjs/experimental/tasks/stores/in-memory.js +3 -5
- package/dist/cjs/experimental/tasks/stores/in-memory.js.map +1 -1
- package/dist/cjs/inMemory.js +5 -7
- package/dist/cjs/inMemory.js.map +1 -1
- package/dist/cjs/server/auth/handlers/token.js +1 -1
- package/dist/cjs/server/auth/handlers/token.js.map +1 -1
- package/dist/cjs/server/auth/providers/proxyProvider.js +11 -17
- package/dist/cjs/server/auth/providers/proxyProvider.js.map +1 -1
- package/dist/cjs/server/auth/router.js +3 -6
- package/dist/cjs/server/auth/router.js.map +1 -1
- package/dist/cjs/server/completable.js +1 -1
- package/dist/cjs/server/completable.js.map +1 -1
- package/dist/cjs/server/index.d.ts +3 -3
- package/dist/cjs/server/index.d.ts.map +1 -1
- package/dist/cjs/server/index.js +20 -30
- package/dist/cjs/server/index.js.map +1 -1
- package/dist/cjs/server/mcp.d.ts.map +1 -1
- package/dist/cjs/server/mcp.js +25 -11
- package/dist/cjs/server/mcp.js.map +1 -1
- package/dist/cjs/server/middleware/hostHeaderValidation.js +1 -1
- package/dist/cjs/server/middleware/hostHeaderValidation.js.map +1 -1
- package/dist/cjs/server/sse.js +14 -17
- package/dist/cjs/server/sse.js.map +1 -1
- package/dist/cjs/server/stdio.js +4 -7
- package/dist/cjs/server/stdio.js.map +1 -1
- package/dist/cjs/server/streamableHttp.d.ts +52 -154
- package/dist/cjs/server/streamableHttp.d.ts.map +1 -1
- package/dist/cjs/server/streamableHttp.js +78 -653
- package/dist/cjs/server/streamableHttp.js.map +1 -1
- package/dist/cjs/server/webStandardStreamableHttp.d.ts +267 -0
- package/dist/cjs/server/webStandardStreamableHttp.d.ts.map +1 -0
- package/dist/cjs/server/webStandardStreamableHttp.js +729 -0
- package/dist/cjs/server/webStandardStreamableHttp.js.map +1 -0
- package/dist/cjs/server/zod-compat.d.ts +3 -1
- package/dist/cjs/server/zod-compat.d.ts.map +1 -1
- package/dist/cjs/server/zod-compat.js +11 -19
- package/dist/cjs/server/zod-compat.js.map +1 -1
- package/dist/cjs/server/zod-json-schema-compat.js +5 -6
- package/dist/cjs/server/zod-json-schema-compat.js.map +1 -1
- package/dist/cjs/shared/metadataUtils.js +1 -2
- package/dist/cjs/shared/metadataUtils.js.map +1 -1
- package/dist/cjs/shared/protocol.d.ts +1 -1
- package/dist/cjs/shared/protocol.d.ts.map +1 -1
- package/dist/cjs/shared/protocol.js +76 -88
- package/dist/cjs/shared/protocol.js.map +1 -1
- package/dist/cjs/shared/transport.js +1 -1
- package/dist/cjs/shared/transport.js.map +1 -1
- package/dist/cjs/spec.types.d.ts +315 -26
- package/dist/cjs/spec.types.d.ts.map +1 -1
- package/dist/cjs/spec.types.js +2 -2
- package/dist/cjs/spec.types.js.map +1 -1
- package/dist/cjs/types.d.ts +1424 -1240
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/types.js +227 -136
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/validation/ajv-provider.d.ts +1 -1
- package/dist/cjs/validation/ajv-provider.d.ts.map +1 -1
- package/dist/cjs/validation/ajv-provider.js +4 -5
- package/dist/cjs/validation/ajv-provider.js.map +1 -1
- package/dist/cjs/validation/cfworker-provider.js +4 -5
- package/dist/cjs/validation/cfworker-provider.js.map +1 -1
- package/dist/cjs/validation/types.d.ts +12 -2
- package/dist/cjs/validation/types.d.ts.map +1 -1
- package/dist/esm/client/auth-extensions.js +5 -9
- package/dist/esm/client/auth-extensions.js.map +1 -1
- package/dist/esm/client/auth.js +30 -37
- package/dist/esm/client/auth.js.map +1 -1
- package/dist/esm/client/index.d.ts +61 -14
- package/dist/esm/client/index.d.ts.map +1 -1
- package/dist/esm/client/index.js +118 -37
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/client/middleware.js +3 -3
- package/dist/esm/client/middleware.js.map +1 -1
- package/dist/esm/client/sse.js +19 -27
- package/dist/esm/client/sse.js.map +1 -1
- package/dist/esm/client/stdio.js +18 -28
- package/dist/esm/client/stdio.js.map +1 -1
- package/dist/esm/client/streamableHttp.d.ts.map +1 -1
- package/dist/esm/client/streamableHttp.js +40 -50
- package/dist/esm/client/streamableHttp.js.map +1 -1
- package/dist/esm/client/websocket.js +6 -11
- package/dist/esm/client/websocket.js.map +1 -1
- package/dist/esm/examples/client/elicitationUrlExample.js +4 -5
- package/dist/esm/examples/client/elicitationUrlExample.js.map +1 -1
- package/dist/esm/examples/client/simpleOAuthClient.js +3 -3
- package/dist/esm/examples/client/simpleOAuthClient.js.map +1 -1
- package/dist/esm/examples/client/simpleStreamableHttp.js +7 -9
- package/dist/esm/examples/client/simpleStreamableHttp.js.map +1 -1
- package/dist/esm/examples/client/simpleTaskInteractiveClient.js +1 -2
- package/dist/esm/examples/client/simpleTaskInteractiveClient.js.map +1 -1
- package/dist/esm/examples/server/honoWebStandardStreamableHttp.d.ts +10 -0
- package/dist/esm/examples/server/honoWebStandardStreamableHttp.d.ts.map +1 -0
- package/dist/esm/examples/server/honoWebStandardStreamableHttp.js +56 -0
- package/dist/esm/examples/server/honoWebStandardStreamableHttp.js.map +1 -0
- package/dist/esm/examples/server/jsonResponseStreamableHttp.js +10 -4
- package/dist/esm/examples/server/jsonResponseStreamableHttp.js.map +1 -1
- package/dist/esm/examples/server/simpleSseServer.js +6 -3
- package/dist/esm/examples/server/simpleSseServer.js.map +1 -1
- package/dist/esm/examples/server/simpleStatelessStreamableHttp.js +12 -6
- package/dist/esm/examples/server/simpleStatelessStreamableHttp.js.map +1 -1
- package/dist/esm/examples/server/simpleStreamableHttp.js +21 -11
- package/dist/esm/examples/server/simpleStreamableHttp.js.map +1 -1
- package/dist/esm/examples/server/simpleTaskInteractive.js +7 -11
- package/dist/esm/examples/server/simpleTaskInteractive.js.map +1 -1
- package/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js +10 -7
- package/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
- package/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.js +1 -1
- package/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.js.map +1 -1
- package/dist/esm/experimental/tasks/client.js +1 -2
- package/dist/esm/experimental/tasks/client.js.map +1 -1
- package/dist/esm/experimental/tasks/helpers.js +3 -5
- package/dist/esm/experimental/tasks/helpers.js.map +1 -1
- package/dist/esm/experimental/tasks/interfaces.d.ts +3 -3
- package/dist/esm/experimental/tasks/interfaces.d.ts.map +1 -1
- package/dist/esm/experimental/tasks/stores/in-memory.d.ts +1 -1
- package/dist/esm/experimental/tasks/stores/in-memory.d.ts.map +1 -1
- package/dist/esm/experimental/tasks/stores/in-memory.js +3 -5
- package/dist/esm/experimental/tasks/stores/in-memory.js.map +1 -1
- package/dist/esm/inMemory.js +5 -7
- package/dist/esm/inMemory.js.map +1 -1
- package/dist/esm/server/auth/handlers/token.js +1 -1
- package/dist/esm/server/auth/handlers/token.js.map +1 -1
- package/dist/esm/server/auth/providers/proxyProvider.js +11 -17
- package/dist/esm/server/auth/providers/proxyProvider.js.map +1 -1
- package/dist/esm/server/auth/router.js +3 -6
- package/dist/esm/server/auth/router.js.map +1 -1
- package/dist/esm/server/completable.js +1 -1
- package/dist/esm/server/completable.js.map +1 -1
- package/dist/esm/server/index.d.ts +3 -3
- package/dist/esm/server/index.d.ts.map +1 -1
- package/dist/esm/server/index.js +20 -30
- package/dist/esm/server/index.js.map +1 -1
- package/dist/esm/server/mcp.d.ts.map +1 -1
- package/dist/esm/server/mcp.js +25 -11
- package/dist/esm/server/mcp.js.map +1 -1
- package/dist/esm/server/middleware/hostHeaderValidation.js +1 -1
- package/dist/esm/server/middleware/hostHeaderValidation.js.map +1 -1
- package/dist/esm/server/sse.js +14 -17
- package/dist/esm/server/sse.js.map +1 -1
- package/dist/esm/server/stdio.js +4 -7
- package/dist/esm/server/stdio.js.map +1 -1
- package/dist/esm/server/streamableHttp.d.ts +52 -154
- package/dist/esm/server/streamableHttp.d.ts.map +1 -1
- package/dist/esm/server/streamableHttp.js +78 -650
- package/dist/esm/server/streamableHttp.js.map +1 -1
- package/dist/esm/server/webStandardStreamableHttp.d.ts +267 -0
- package/dist/esm/server/webStandardStreamableHttp.d.ts.map +1 -0
- package/dist/esm/server/webStandardStreamableHttp.js +725 -0
- package/dist/esm/server/webStandardStreamableHttp.js.map +1 -0
- package/dist/esm/server/zod-compat.d.ts +3 -1
- package/dist/esm/server/zod-compat.d.ts.map +1 -1
- package/dist/esm/server/zod-compat.js +11 -19
- package/dist/esm/server/zod-compat.js.map +1 -1
- package/dist/esm/server/zod-json-schema-compat.js +5 -6
- package/dist/esm/server/zod-json-schema-compat.js.map +1 -1
- package/dist/esm/shared/metadataUtils.js +1 -2
- package/dist/esm/shared/metadataUtils.js.map +1 -1
- package/dist/esm/shared/protocol.d.ts +1 -1
- package/dist/esm/shared/protocol.d.ts.map +1 -1
- package/dist/esm/shared/protocol.js +77 -89
- package/dist/esm/shared/protocol.js.map +1 -1
- package/dist/esm/shared/transport.js +1 -1
- package/dist/esm/shared/transport.js.map +1 -1
- package/dist/esm/spec.types.d.ts +315 -26
- package/dist/esm/spec.types.d.ts.map +1 -1
- package/dist/esm/spec.types.js +2 -2
- package/dist/esm/spec.types.js.map +1 -1
- package/dist/esm/types.d.ts +1430 -1246
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js +220 -130
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/validation/ajv-provider.d.ts +1 -1
- package/dist/esm/validation/ajv-provider.d.ts.map +1 -1
- package/dist/esm/validation/ajv-provider.js +3 -4
- package/dist/esm/validation/ajv-provider.js.map +1 -1
- package/dist/esm/validation/cfworker-provider.js +4 -5
- package/dist/esm/validation/cfworker-provider.js.map +1 -1
- package/dist/esm/validation/types.d.ts +12 -2
- package/dist/esm/validation/types.d.ts.map +1 -1
- package/package.json +3 -1
package/dist/cjs/types.js
CHANGED
|
@@ -23,10 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
28
|
-
exports.
|
|
29
|
-
exports.UrlElicitationRequiredError = exports.McpError = exports.ServerResultSchema = exports.ServerNotificationSchema = exports.ServerRequestSchema = exports.ClientResultSchema = exports.ClientNotificationSchema = exports.ClientRequestSchema = void 0;
|
|
26
|
+
exports.ProgressNotificationParamsSchema = exports.ProgressSchema = exports.PingRequestSchema = exports.isInitializedNotification = exports.InitializedNotificationSchema = exports.InitializeResultSchema = exports.ServerCapabilitiesSchema = exports.isInitializeRequest = exports.InitializeRequestSchema = exports.InitializeRequestParamsSchema = exports.ClientCapabilitiesSchema = exports.ServerTasksCapabilitySchema = exports.ClientTasksCapabilitySchema = exports.ImplementationSchema = exports.BaseMetadataSchema = exports.IconsSchema = exports.IconSchema = exports.CancelledNotificationSchema = exports.CancelledNotificationParamsSchema = exports.EmptyResultSchema = exports.JSONRPCResponseSchema = exports.JSONRPCMessageSchema = exports.isJSONRPCError = exports.isJSONRPCErrorResponse = exports.JSONRPCErrorSchema = exports.JSONRPCErrorResponseSchema = exports.ErrorCode = exports.isJSONRPCResponse = exports.isJSONRPCResultResponse = exports.JSONRPCResultResponseSchema = exports.isJSONRPCNotification = exports.JSONRPCNotificationSchema = exports.isJSONRPCRequest = exports.JSONRPCRequestSchema = exports.RequestIdSchema = exports.ResultSchema = exports.NotificationSchema = exports.RequestSchema = exports.isTaskAugmentedRequestParams = exports.TaskAugmentedRequestParamsSchema = exports.RelatedTaskMetadataSchema = exports.TaskMetadataSchema = exports.TaskCreationParamsSchema = exports.CursorSchema = exports.ProgressTokenSchema = exports.JSONRPC_VERSION = exports.RELATED_TASK_META_KEY = exports.SUPPORTED_PROTOCOL_VERSIONS = exports.DEFAULT_NEGOTIATED_PROTOCOL_VERSION = exports.LATEST_PROTOCOL_VERSION = void 0;
|
|
27
|
+
exports.EmbeddedResourceSchema = exports.ToolUseContentSchema = exports.AudioContentSchema = exports.ImageContentSchema = exports.TextContentSchema = exports.GetPromptRequestSchema = exports.GetPromptRequestParamsSchema = exports.ListPromptsResultSchema = exports.ListPromptsRequestSchema = exports.PromptSchema = exports.PromptArgumentSchema = exports.ResourceUpdatedNotificationSchema = exports.ResourceUpdatedNotificationParamsSchema = exports.UnsubscribeRequestSchema = exports.UnsubscribeRequestParamsSchema = exports.SubscribeRequestSchema = exports.SubscribeRequestParamsSchema = exports.ResourceListChangedNotificationSchema = exports.ReadResourceResultSchema = exports.ReadResourceRequestSchema = exports.ReadResourceRequestParamsSchema = exports.ResourceRequestParamsSchema = exports.ListResourceTemplatesResultSchema = exports.ListResourceTemplatesRequestSchema = exports.ListResourcesResultSchema = exports.ListResourcesRequestSchema = exports.ResourceTemplateSchema = exports.ResourceSchema = exports.AnnotationsSchema = exports.RoleSchema = exports.BlobResourceContentsSchema = exports.TextResourceContentsSchema = exports.ResourceContentsSchema = exports.CancelTaskResultSchema = exports.CancelTaskRequestSchema = exports.ListTasksResultSchema = exports.ListTasksRequestSchema = exports.GetTaskPayloadResultSchema = exports.GetTaskPayloadRequestSchema = exports.GetTaskResultSchema = exports.GetTaskRequestSchema = exports.TaskStatusNotificationSchema = exports.TaskStatusNotificationParamsSchema = exports.CreateTaskResultSchema = exports.TaskSchema = exports.TaskStatusSchema = exports.PaginatedResultSchema = exports.PaginatedRequestSchema = exports.PaginatedRequestParamsSchema = exports.ProgressNotificationSchema = void 0;
|
|
28
|
+
exports.ElicitationCompleteNotificationSchema = exports.ElicitationCompleteNotificationParamsSchema = exports.ElicitRequestSchema = exports.ElicitRequestParamsSchema = exports.ElicitRequestURLParamsSchema = exports.ElicitRequestFormParamsSchema = exports.PrimitiveSchemaDefinitionSchema = exports.EnumSchemaSchema = exports.MultiSelectEnumSchemaSchema = exports.TitledMultiSelectEnumSchemaSchema = exports.UntitledMultiSelectEnumSchemaSchema = exports.SingleSelectEnumSchemaSchema = exports.LegacyTitledEnumSchemaSchema = exports.TitledSingleSelectEnumSchemaSchema = exports.UntitledSingleSelectEnumSchemaSchema = exports.NumberSchemaSchema = exports.StringSchemaSchema = exports.BooleanSchemaSchema = exports.CreateMessageResultWithToolsSchema = exports.CreateMessageResultSchema = exports.CreateMessageRequestSchema = exports.CreateMessageRequestParamsSchema = exports.SamplingMessageSchema = exports.SamplingMessageContentBlockSchema = exports.SamplingContentSchema = exports.ToolResultContentSchema = exports.ToolChoiceSchema = exports.ModelPreferencesSchema = exports.ModelHintSchema = exports.LoggingMessageNotificationSchema = exports.LoggingMessageNotificationParamsSchema = exports.SetLevelRequestSchema = exports.SetLevelRequestParamsSchema = exports.LoggingLevelSchema = exports.ListChangedOptionsBaseSchema = exports.ToolListChangedNotificationSchema = exports.CallToolRequestSchema = exports.CallToolRequestParamsSchema = exports.CompatibilityCallToolResultSchema = exports.CallToolResultSchema = exports.ListToolsResultSchema = exports.ListToolsRequestSchema = exports.ToolSchema = exports.ToolExecutionSchema = exports.ToolAnnotationsSchema = exports.PromptListChangedNotificationSchema = exports.GetPromptResultSchema = exports.PromptMessageSchema = exports.ContentBlockSchema = exports.ResourceLinkSchema = void 0;
|
|
29
|
+
exports.UrlElicitationRequiredError = exports.McpError = exports.ServerResultSchema = exports.ServerNotificationSchema = exports.ServerRequestSchema = exports.ClientResultSchema = exports.ClientNotificationSchema = exports.ClientRequestSchema = exports.RootsListChangedNotificationSchema = exports.ListRootsResultSchema = exports.ListRootsRequestSchema = exports.RootSchema = exports.CompleteResultSchema = exports.CompleteRequestSchema = exports.CompleteRequestParamsSchema = exports.PromptReferenceSchema = exports.ResourceReferenceSchema = exports.ResourceTemplateReferenceSchema = exports.ElicitResultSchema = void 0;
|
|
30
30
|
exports.assertCompleteRequestPrompt = assertCompleteRequestPrompt;
|
|
31
31
|
exports.assertCompleteRequestResourceTemplate = assertCompleteRequestResourceTemplate;
|
|
32
32
|
const z = __importStar(require("zod/v4"));
|
|
@@ -64,10 +64,14 @@ exports.TaskCreationParamsSchema = z.looseObject({
|
|
|
64
64
|
*/
|
|
65
65
|
pollInterval: z.number().optional()
|
|
66
66
|
});
|
|
67
|
+
exports.TaskMetadataSchema = z.object({
|
|
68
|
+
ttl: z.number().optional()
|
|
69
|
+
});
|
|
67
70
|
/**
|
|
68
|
-
*
|
|
71
|
+
* Metadata for associating messages with a task.
|
|
72
|
+
* Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`.
|
|
69
73
|
*/
|
|
70
|
-
exports.RelatedTaskMetadataSchema = z.
|
|
74
|
+
exports.RelatedTaskMetadataSchema = z.object({
|
|
71
75
|
taskId: z.string()
|
|
72
76
|
});
|
|
73
77
|
const RequestMetaSchema = z.looseObject({
|
|
@@ -83,53 +87,55 @@ const RequestMetaSchema = z.looseObject({
|
|
|
83
87
|
/**
|
|
84
88
|
* Common params for any request.
|
|
85
89
|
*/
|
|
86
|
-
const BaseRequestParamsSchema = z.
|
|
87
|
-
/**
|
|
88
|
-
* If specified, the caller is requesting that the receiver create a task to represent the request.
|
|
89
|
-
* Task creation parameters are now at the top level instead of in _meta.
|
|
90
|
-
*/
|
|
91
|
-
task: exports.TaskCreationParamsSchema.optional(),
|
|
90
|
+
const BaseRequestParamsSchema = z.object({
|
|
92
91
|
/**
|
|
93
92
|
* See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.
|
|
94
93
|
*/
|
|
95
94
|
_meta: RequestMetaSchema.optional()
|
|
96
95
|
});
|
|
96
|
+
/**
|
|
97
|
+
* Common params for any task-augmented request.
|
|
98
|
+
*/
|
|
99
|
+
exports.TaskAugmentedRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
100
|
+
/**
|
|
101
|
+
* If specified, the caller is requesting task-augmented execution for this request.
|
|
102
|
+
* The request will return a CreateTaskResult immediately, and the actual result can be
|
|
103
|
+
* retrieved later via tasks/result.
|
|
104
|
+
*
|
|
105
|
+
* Task augmentation is subject to capability negotiation - receivers MUST declare support
|
|
106
|
+
* for task augmentation of specific request types in their capabilities.
|
|
107
|
+
*/
|
|
108
|
+
task: exports.TaskMetadataSchema.optional()
|
|
109
|
+
});
|
|
110
|
+
/**
|
|
111
|
+
* Checks if a value is a valid TaskAugmentedRequestParams.
|
|
112
|
+
* @param value - The value to check.
|
|
113
|
+
*
|
|
114
|
+
* @returns True if the value is a valid TaskAugmentedRequestParams, false otherwise.
|
|
115
|
+
*/
|
|
116
|
+
const isTaskAugmentedRequestParams = (value) => exports.TaskAugmentedRequestParamsSchema.safeParse(value).success;
|
|
117
|
+
exports.isTaskAugmentedRequestParams = isTaskAugmentedRequestParams;
|
|
97
118
|
exports.RequestSchema = z.object({
|
|
98
119
|
method: z.string(),
|
|
99
|
-
params: BaseRequestParamsSchema.optional()
|
|
120
|
+
params: BaseRequestParamsSchema.loose().optional()
|
|
100
121
|
});
|
|
101
|
-
const NotificationsParamsSchema = z.
|
|
122
|
+
const NotificationsParamsSchema = z.object({
|
|
102
123
|
/**
|
|
103
124
|
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
104
125
|
* for notes on _meta usage.
|
|
105
126
|
*/
|
|
106
|
-
_meta:
|
|
107
|
-
.object({
|
|
108
|
-
/**
|
|
109
|
-
* If specified, this notification is related to the provided task.
|
|
110
|
-
*/
|
|
111
|
-
[exports.RELATED_TASK_META_KEY]: z.optional(exports.RelatedTaskMetadataSchema)
|
|
112
|
-
})
|
|
113
|
-
.passthrough()
|
|
114
|
-
.optional()
|
|
127
|
+
_meta: RequestMetaSchema.optional()
|
|
115
128
|
});
|
|
116
129
|
exports.NotificationSchema = z.object({
|
|
117
130
|
method: z.string(),
|
|
118
|
-
params: NotificationsParamsSchema.optional()
|
|
131
|
+
params: NotificationsParamsSchema.loose().optional()
|
|
119
132
|
});
|
|
120
133
|
exports.ResultSchema = z.looseObject({
|
|
121
134
|
/**
|
|
122
135
|
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
123
136
|
* for notes on _meta usage.
|
|
124
137
|
*/
|
|
125
|
-
_meta:
|
|
126
|
-
.looseObject({
|
|
127
|
-
/**
|
|
128
|
-
* If specified, this result is related to the provided task.
|
|
129
|
-
*/
|
|
130
|
-
[exports.RELATED_TASK_META_KEY]: exports.RelatedTaskMetadataSchema.optional()
|
|
131
|
-
})
|
|
132
|
-
.optional()
|
|
138
|
+
_meta: RequestMetaSchema.optional()
|
|
133
139
|
});
|
|
134
140
|
/**
|
|
135
141
|
* A uniquely identifying ID for a request in JSON-RPC.
|
|
@@ -161,15 +167,27 @@ exports.isJSONRPCNotification = isJSONRPCNotification;
|
|
|
161
167
|
/**
|
|
162
168
|
* A successful (non-error) response to a request.
|
|
163
169
|
*/
|
|
164
|
-
exports.
|
|
170
|
+
exports.JSONRPCResultResponseSchema = z
|
|
165
171
|
.object({
|
|
166
172
|
jsonrpc: z.literal(exports.JSONRPC_VERSION),
|
|
167
173
|
id: exports.RequestIdSchema,
|
|
168
174
|
result: exports.ResultSchema
|
|
169
175
|
})
|
|
170
176
|
.strict();
|
|
171
|
-
|
|
172
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Checks if a value is a valid JSONRPCResultResponse.
|
|
179
|
+
* @param value - The value to check.
|
|
180
|
+
*
|
|
181
|
+
* @returns True if the value is a valid JSONRPCResultResponse, false otherwise.
|
|
182
|
+
*/
|
|
183
|
+
const isJSONRPCResultResponse = (value) => exports.JSONRPCResultResponseSchema.safeParse(value).success;
|
|
184
|
+
exports.isJSONRPCResultResponse = isJSONRPCResultResponse;
|
|
185
|
+
/**
|
|
186
|
+
* @deprecated Use {@link isJSONRPCResultResponse} instead.
|
|
187
|
+
*
|
|
188
|
+
* Please note that {@link JSONRPCResponse} is a union of {@link JSONRPCResultResponse} and {@link JSONRPCErrorResponse} as per the updated JSON-RPC specification. (was previously just {@link JSONRPCResultResponse})
|
|
189
|
+
*/
|
|
190
|
+
exports.isJSONRPCResponse = exports.isJSONRPCResultResponse;
|
|
173
191
|
/**
|
|
174
192
|
* Error codes defined by the JSON-RPC specification.
|
|
175
193
|
*/
|
|
@@ -190,10 +208,10 @@ var ErrorCode;
|
|
|
190
208
|
/**
|
|
191
209
|
* A response to a request that indicates an error occurred.
|
|
192
210
|
*/
|
|
193
|
-
exports.
|
|
211
|
+
exports.JSONRPCErrorResponseSchema = z
|
|
194
212
|
.object({
|
|
195
213
|
jsonrpc: z.literal(exports.JSONRPC_VERSION),
|
|
196
|
-
id: exports.RequestIdSchema,
|
|
214
|
+
id: exports.RequestIdSchema.optional(),
|
|
197
215
|
error: z.object({
|
|
198
216
|
/**
|
|
199
217
|
* The error type that occurred.
|
|
@@ -206,13 +224,33 @@ exports.JSONRPCErrorSchema = z
|
|
|
206
224
|
/**
|
|
207
225
|
* Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
|
|
208
226
|
*/
|
|
209
|
-
data: z.
|
|
227
|
+
data: z.unknown().optional()
|
|
210
228
|
})
|
|
211
229
|
})
|
|
212
230
|
.strict();
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
231
|
+
/**
|
|
232
|
+
* @deprecated Use {@link JSONRPCErrorResponseSchema} instead.
|
|
233
|
+
*/
|
|
234
|
+
exports.JSONRPCErrorSchema = exports.JSONRPCErrorResponseSchema;
|
|
235
|
+
/**
|
|
236
|
+
* Checks if a value is a valid JSONRPCErrorResponse.
|
|
237
|
+
* @param value - The value to check.
|
|
238
|
+
*
|
|
239
|
+
* @returns True if the value is a valid JSONRPCErrorResponse, false otherwise.
|
|
240
|
+
*/
|
|
241
|
+
const isJSONRPCErrorResponse = (value) => exports.JSONRPCErrorResponseSchema.safeParse(value).success;
|
|
242
|
+
exports.isJSONRPCErrorResponse = isJSONRPCErrorResponse;
|
|
243
|
+
/**
|
|
244
|
+
* @deprecated Use {@link isJSONRPCErrorResponse} instead.
|
|
245
|
+
*/
|
|
246
|
+
exports.isJSONRPCError = exports.isJSONRPCErrorResponse;
|
|
247
|
+
exports.JSONRPCMessageSchema = z.union([
|
|
248
|
+
exports.JSONRPCRequestSchema,
|
|
249
|
+
exports.JSONRPCNotificationSchema,
|
|
250
|
+
exports.JSONRPCResultResponseSchema,
|
|
251
|
+
exports.JSONRPCErrorResponseSchema
|
|
252
|
+
]);
|
|
253
|
+
exports.JSONRPCResponseSchema = z.union([exports.JSONRPCResultResponseSchema, exports.JSONRPCErrorResponseSchema]);
|
|
216
254
|
/* Empty result */
|
|
217
255
|
/**
|
|
218
256
|
* A response that indicates success but carries no data.
|
|
@@ -224,7 +262,7 @@ exports.CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({
|
|
|
224
262
|
*
|
|
225
263
|
* This MUST correspond to the ID of a request previously issued in the same direction.
|
|
226
264
|
*/
|
|
227
|
-
requestId: exports.RequestIdSchema,
|
|
265
|
+
requestId: exports.RequestIdSchema.optional(),
|
|
228
266
|
/**
|
|
229
267
|
* An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
|
|
230
268
|
*/
|
|
@@ -263,7 +301,15 @@ exports.IconSchema = z.object({
|
|
|
263
301
|
*
|
|
264
302
|
* If not provided, the client should assume that the icon can be used at any size.
|
|
265
303
|
*/
|
|
266
|
-
sizes: z.array(z.string()).optional()
|
|
304
|
+
sizes: z.array(z.string()).optional(),
|
|
305
|
+
/**
|
|
306
|
+
* Optional specifier for the theme this icon is designed for. `light` indicates
|
|
307
|
+
* the icon is designed to be used with a light background, and `dark` indicates
|
|
308
|
+
* the icon is designed to be used with a dark background.
|
|
309
|
+
*
|
|
310
|
+
* If not provided, the client should assume the icon can be used with any theme.
|
|
311
|
+
*/
|
|
312
|
+
theme: z.enum(['light', 'dark']).optional()
|
|
267
313
|
});
|
|
268
314
|
/**
|
|
269
315
|
* Base schema to add `icons` property.
|
|
@@ -310,7 +356,15 @@ exports.ImplementationSchema = exports.BaseMetadataSchema.extend({
|
|
|
310
356
|
/**
|
|
311
357
|
* An optional URL of the website for this implementation.
|
|
312
358
|
*/
|
|
313
|
-
websiteUrl: z.string().optional()
|
|
359
|
+
websiteUrl: z.string().optional(),
|
|
360
|
+
/**
|
|
361
|
+
* An optional human-readable description of what this implementation does.
|
|
362
|
+
*
|
|
363
|
+
* This can be used by clients or servers to provide context about their purpose
|
|
364
|
+
* and capabilities. For example, a server might describe the types of resources
|
|
365
|
+
* or tools it provides, while a client might describe its intended use case.
|
|
366
|
+
*/
|
|
367
|
+
description: z.string().optional()
|
|
314
368
|
});
|
|
315
369
|
const FormElicitationCapabilitySchema = z.intersection(z.object({
|
|
316
370
|
applyDefaults: z.boolean().optional()
|
|
@@ -329,71 +383,67 @@ const ElicitationCapabilitySchema = z.preprocess(value => {
|
|
|
329
383
|
/**
|
|
330
384
|
* Task capabilities for clients, indicating which request types support task creation.
|
|
331
385
|
*/
|
|
332
|
-
exports.ClientTasksCapabilitySchema = z
|
|
333
|
-
.object({
|
|
386
|
+
exports.ClientTasksCapabilitySchema = z.looseObject({
|
|
334
387
|
/**
|
|
335
388
|
* Present if the client supports listing tasks.
|
|
336
389
|
*/
|
|
337
|
-
list:
|
|
390
|
+
list: AssertObjectSchema.optional(),
|
|
338
391
|
/**
|
|
339
392
|
* Present if the client supports cancelling tasks.
|
|
340
393
|
*/
|
|
341
|
-
cancel:
|
|
394
|
+
cancel: AssertObjectSchema.optional(),
|
|
342
395
|
/**
|
|
343
396
|
* Capabilities for task creation on specific request types.
|
|
344
397
|
*/
|
|
345
|
-
requests: z
|
|
346
|
-
.
|
|
398
|
+
requests: z
|
|
399
|
+
.looseObject({
|
|
347
400
|
/**
|
|
348
401
|
* Task support for sampling requests.
|
|
349
402
|
*/
|
|
350
|
-
sampling: z
|
|
351
|
-
.
|
|
352
|
-
createMessage:
|
|
403
|
+
sampling: z
|
|
404
|
+
.looseObject({
|
|
405
|
+
createMessage: AssertObjectSchema.optional()
|
|
353
406
|
})
|
|
354
|
-
.
|
|
407
|
+
.optional(),
|
|
355
408
|
/**
|
|
356
409
|
* Task support for elicitation requests.
|
|
357
410
|
*/
|
|
358
|
-
elicitation: z
|
|
359
|
-
.
|
|
360
|
-
create:
|
|
411
|
+
elicitation: z
|
|
412
|
+
.looseObject({
|
|
413
|
+
create: AssertObjectSchema.optional()
|
|
361
414
|
})
|
|
362
|
-
.
|
|
415
|
+
.optional()
|
|
363
416
|
})
|
|
364
|
-
.
|
|
365
|
-
})
|
|
366
|
-
.passthrough();
|
|
417
|
+
.optional()
|
|
418
|
+
});
|
|
367
419
|
/**
|
|
368
420
|
* Task capabilities for servers, indicating which request types support task creation.
|
|
369
421
|
*/
|
|
370
|
-
exports.ServerTasksCapabilitySchema = z
|
|
371
|
-
.object({
|
|
422
|
+
exports.ServerTasksCapabilitySchema = z.looseObject({
|
|
372
423
|
/**
|
|
373
424
|
* Present if the server supports listing tasks.
|
|
374
425
|
*/
|
|
375
|
-
list:
|
|
426
|
+
list: AssertObjectSchema.optional(),
|
|
376
427
|
/**
|
|
377
428
|
* Present if the server supports cancelling tasks.
|
|
378
429
|
*/
|
|
379
|
-
cancel:
|
|
430
|
+
cancel: AssertObjectSchema.optional(),
|
|
380
431
|
/**
|
|
381
432
|
* Capabilities for task creation on specific request types.
|
|
382
433
|
*/
|
|
383
|
-
requests: z
|
|
384
|
-
.
|
|
434
|
+
requests: z
|
|
435
|
+
.looseObject({
|
|
385
436
|
/**
|
|
386
437
|
* Task support for tool requests.
|
|
387
438
|
*/
|
|
388
|
-
tools: z
|
|
389
|
-
.
|
|
390
|
-
call:
|
|
439
|
+
tools: z
|
|
440
|
+
.looseObject({
|
|
441
|
+
call: AssertObjectSchema.optional()
|
|
391
442
|
})
|
|
392
|
-
.
|
|
443
|
+
.optional()
|
|
393
444
|
})
|
|
394
|
-
.
|
|
395
|
-
})
|
|
396
|
-
.passthrough();
|
|
445
|
+
.optional()
|
|
446
|
+
});
|
|
397
447
|
/**
|
|
398
448
|
* 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.
|
|
399
449
|
*/
|
|
@@ -436,7 +486,7 @@ exports.ClientCapabilitiesSchema = z.object({
|
|
|
436
486
|
/**
|
|
437
487
|
* Present if the client supports task creation.
|
|
438
488
|
*/
|
|
439
|
-
tasks:
|
|
489
|
+
tasks: exports.ClientTasksCapabilitySchema.optional()
|
|
440
490
|
});
|
|
441
491
|
exports.InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
442
492
|
/**
|
|
@@ -458,8 +508,7 @@ exports.isInitializeRequest = isInitializeRequest;
|
|
|
458
508
|
/**
|
|
459
509
|
* 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.
|
|
460
510
|
*/
|
|
461
|
-
exports.ServerCapabilitiesSchema = z
|
|
462
|
-
.object({
|
|
511
|
+
exports.ServerCapabilitiesSchema = z.object({
|
|
463
512
|
/**
|
|
464
513
|
* Experimental, non-standard capabilities that the server supports.
|
|
465
514
|
*/
|
|
@@ -475,12 +524,14 @@ exports.ServerCapabilitiesSchema = z
|
|
|
475
524
|
/**
|
|
476
525
|
* Present if the server offers any prompt templates.
|
|
477
526
|
*/
|
|
478
|
-
prompts: z
|
|
527
|
+
prompts: z
|
|
528
|
+
.object({
|
|
479
529
|
/**
|
|
480
530
|
* Whether this server supports issuing notifications for changes to the prompt list.
|
|
481
531
|
*/
|
|
482
|
-
listChanged: z.
|
|
483
|
-
})
|
|
532
|
+
listChanged: z.boolean().optional()
|
|
533
|
+
})
|
|
534
|
+
.optional(),
|
|
484
535
|
/**
|
|
485
536
|
* Present if the server offers any resources to read.
|
|
486
537
|
*/
|
|
@@ -510,9 +561,8 @@ exports.ServerCapabilitiesSchema = z
|
|
|
510
561
|
/**
|
|
511
562
|
* Present if the server supports task creation.
|
|
512
563
|
*/
|
|
513
|
-
tasks:
|
|
514
|
-
})
|
|
515
|
-
.passthrough();
|
|
564
|
+
tasks: exports.ServerTasksCapabilitySchema.optional()
|
|
565
|
+
});
|
|
516
566
|
/**
|
|
517
567
|
* After receiving an initialize request from the client, the server sends this response.
|
|
518
568
|
*/
|
|
@@ -534,7 +584,8 @@ exports.InitializeResultSchema = exports.ResultSchema.extend({
|
|
|
534
584
|
* This notification is sent from the client to the server after initialization has finished.
|
|
535
585
|
*/
|
|
536
586
|
exports.InitializedNotificationSchema = exports.NotificationSchema.extend({
|
|
537
|
-
method: z.literal('notifications/initialized')
|
|
587
|
+
method: z.literal('notifications/initialized'),
|
|
588
|
+
params: NotificationsParamsSchema.optional()
|
|
538
589
|
});
|
|
539
590
|
const isInitializedNotification = (value) => exports.InitializedNotificationSchema.safeParse(value).success;
|
|
540
591
|
exports.isInitializedNotification = isInitializedNotification;
|
|
@@ -543,7 +594,8 @@ exports.isInitializedNotification = isInitializedNotification;
|
|
|
543
594
|
* 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.
|
|
544
595
|
*/
|
|
545
596
|
exports.PingRequestSchema = exports.RequestSchema.extend({
|
|
546
|
-
method: z.literal('ping')
|
|
597
|
+
method: z.literal('ping'),
|
|
598
|
+
params: BaseRequestParamsSchema.optional()
|
|
547
599
|
});
|
|
548
600
|
/* Progress notifications */
|
|
549
601
|
exports.ProgressSchema = z.object({
|
|
@@ -593,15 +645,19 @@ exports.PaginatedResultSchema = exports.ResultSchema.extend({
|
|
|
593
645
|
* An opaque token representing the pagination position after the last returned result.
|
|
594
646
|
* If present, there may be more results available.
|
|
595
647
|
*/
|
|
596
|
-
nextCursor:
|
|
648
|
+
nextCursor: exports.CursorSchema.optional()
|
|
597
649
|
});
|
|
650
|
+
/**
|
|
651
|
+
* The status of a task.
|
|
652
|
+
* */
|
|
653
|
+
exports.TaskStatusSchema = z.enum(['working', 'input_required', 'completed', 'failed', 'cancelled']);
|
|
598
654
|
/* Tasks */
|
|
599
655
|
/**
|
|
600
656
|
* A pollable state object associated with a request.
|
|
601
657
|
*/
|
|
602
658
|
exports.TaskSchema = z.object({
|
|
603
659
|
taskId: z.string(),
|
|
604
|
-
status:
|
|
660
|
+
status: exports.TaskStatusSchema,
|
|
605
661
|
/**
|
|
606
662
|
* Time in milliseconds to keep task results available after completion.
|
|
607
663
|
* If null, the task has unlimited lifetime until manually cleaned up.
|
|
@@ -660,6 +716,13 @@ exports.GetTaskPayloadRequestSchema = exports.RequestSchema.extend({
|
|
|
660
716
|
taskId: z.string()
|
|
661
717
|
})
|
|
662
718
|
});
|
|
719
|
+
/**
|
|
720
|
+
* The response to a tasks/result request.
|
|
721
|
+
* The structure matches the result type of the original request.
|
|
722
|
+
* For example, a tools/call task would return the CallToolResult structure.
|
|
723
|
+
*
|
|
724
|
+
*/
|
|
725
|
+
exports.GetTaskPayloadResultSchema = exports.ResultSchema.loose();
|
|
663
726
|
/**
|
|
664
727
|
* A request to list tasks.
|
|
665
728
|
*/
|
|
@@ -722,7 +785,7 @@ const Base64Schema = z.string().refine(val => {
|
|
|
722
785
|
atob(val);
|
|
723
786
|
return true;
|
|
724
787
|
}
|
|
725
|
-
catch
|
|
788
|
+
catch {
|
|
726
789
|
return false;
|
|
727
790
|
}
|
|
728
791
|
}, { message: 'Invalid Base64 string' });
|
|
@@ -732,6 +795,10 @@ exports.BlobResourceContentsSchema = exports.ResourceContentsSchema.extend({
|
|
|
732
795
|
*/
|
|
733
796
|
blob: Base64Schema
|
|
734
797
|
});
|
|
798
|
+
/**
|
|
799
|
+
* The sender or recipient of messages and data in a conversation.
|
|
800
|
+
*/
|
|
801
|
+
exports.RoleSchema = z.enum(['user', 'assistant']);
|
|
735
802
|
/**
|
|
736
803
|
* Optional annotations providing clients additional context about a resource.
|
|
737
804
|
*/
|
|
@@ -739,7 +806,7 @@ exports.AnnotationsSchema = z.object({
|
|
|
739
806
|
/**
|
|
740
807
|
* Intended audience(s) for the resource.
|
|
741
808
|
*/
|
|
742
|
-
audience: z.array(
|
|
809
|
+
audience: z.array(exports.RoleSchema).optional(),
|
|
743
810
|
/**
|
|
744
811
|
* Importance hint for the resource, from 0 (least) to 1 (most).
|
|
745
812
|
*/
|
|
@@ -862,7 +929,8 @@ exports.ReadResourceResultSchema = exports.ResultSchema.extend({
|
|
|
862
929
|
* An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.
|
|
863
930
|
*/
|
|
864
931
|
exports.ResourceListChangedNotificationSchema = exports.NotificationSchema.extend({
|
|
865
|
-
method: z.literal('notifications/resources/list_changed')
|
|
932
|
+
method: z.literal('notifications/resources/list_changed'),
|
|
933
|
+
params: NotificationsParamsSchema.optional()
|
|
866
934
|
});
|
|
867
935
|
exports.SubscribeRequestParamsSchema = exports.ResourceRequestParamsSchema;
|
|
868
936
|
/**
|
|
@@ -1035,8 +1103,7 @@ exports.AudioContentSchema = z.object({
|
|
|
1035
1103
|
* A tool call request from an assistant (LLM).
|
|
1036
1104
|
* Represents the assistant's request to use a tool.
|
|
1037
1105
|
*/
|
|
1038
|
-
exports.ToolUseContentSchema = z
|
|
1039
|
-
.object({
|
|
1106
|
+
exports.ToolUseContentSchema = z.object({
|
|
1040
1107
|
type: z.literal('tool_use'),
|
|
1041
1108
|
/**
|
|
1042
1109
|
* The name of the tool to invoke.
|
|
@@ -1052,14 +1119,13 @@ exports.ToolUseContentSchema = z
|
|
|
1052
1119
|
* Arguments to pass to the tool.
|
|
1053
1120
|
* Must conform to the tool's inputSchema.
|
|
1054
1121
|
*/
|
|
1055
|
-
input: z.
|
|
1122
|
+
input: z.record(z.string(), z.unknown()),
|
|
1056
1123
|
/**
|
|
1057
1124
|
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
1058
1125
|
* for notes on _meta usage.
|
|
1059
1126
|
*/
|
|
1060
|
-
_meta: z.
|
|
1061
|
-
})
|
|
1062
|
-
.passthrough();
|
|
1127
|
+
_meta: z.record(z.string(), z.unknown()).optional()
|
|
1128
|
+
});
|
|
1063
1129
|
/**
|
|
1064
1130
|
* The contents of a resource, embedded into a prompt or tool call result.
|
|
1065
1131
|
*/
|
|
@@ -1098,7 +1164,7 @@ exports.ContentBlockSchema = z.union([
|
|
|
1098
1164
|
* Describes a message returned as part of a prompt.
|
|
1099
1165
|
*/
|
|
1100
1166
|
exports.PromptMessageSchema = z.object({
|
|
1101
|
-
role:
|
|
1167
|
+
role: exports.RoleSchema,
|
|
1102
1168
|
content: exports.ContentBlockSchema
|
|
1103
1169
|
});
|
|
1104
1170
|
/**
|
|
@@ -1108,14 +1174,15 @@ exports.GetPromptResultSchema = exports.ResultSchema.extend({
|
|
|
1108
1174
|
/**
|
|
1109
1175
|
* An optional description for the prompt.
|
|
1110
1176
|
*/
|
|
1111
|
-
description: z.
|
|
1177
|
+
description: z.string().optional(),
|
|
1112
1178
|
messages: z.array(exports.PromptMessageSchema)
|
|
1113
1179
|
});
|
|
1114
1180
|
/**
|
|
1115
1181
|
* An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.
|
|
1116
1182
|
*/
|
|
1117
1183
|
exports.PromptListChangedNotificationSchema = exports.NotificationSchema.extend({
|
|
1118
|
-
method: z.literal('notifications/prompts/list_changed')
|
|
1184
|
+
method: z.literal('notifications/prompts/list_changed'),
|
|
1185
|
+
params: NotificationsParamsSchema.optional()
|
|
1119
1186
|
});
|
|
1120
1187
|
/* Tools */
|
|
1121
1188
|
/**
|
|
@@ -1218,11 +1285,11 @@ exports.ToolSchema = z.object({
|
|
|
1218
1285
|
/**
|
|
1219
1286
|
* Optional additional tool information.
|
|
1220
1287
|
*/
|
|
1221
|
-
annotations:
|
|
1288
|
+
annotations: exports.ToolAnnotationsSchema.optional(),
|
|
1222
1289
|
/**
|
|
1223
1290
|
* Execution-related properties for this tool.
|
|
1224
1291
|
*/
|
|
1225
|
-
execution:
|
|
1292
|
+
execution: exports.ToolExecutionSchema.optional(),
|
|
1226
1293
|
/**
|
|
1227
1294
|
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
1228
1295
|
* for notes on _meta usage.
|
|
@@ -1272,7 +1339,7 @@ exports.CallToolResultSchema = exports.ResultSchema.extend({
|
|
|
1272
1339
|
* server does not support tool calls, or any other exceptional conditions,
|
|
1273
1340
|
* should be reported as an MCP error response.
|
|
1274
1341
|
*/
|
|
1275
|
-
isError: z.
|
|
1342
|
+
isError: z.boolean().optional()
|
|
1276
1343
|
});
|
|
1277
1344
|
/**
|
|
1278
1345
|
* CallToolResultSchema extended with backwards compatibility to protocol version 2024-10-07.
|
|
@@ -1283,7 +1350,7 @@ exports.CompatibilityCallToolResultSchema = exports.CallToolResultSchema.or(expo
|
|
|
1283
1350
|
/**
|
|
1284
1351
|
* Parameters for a `tools/call` request.
|
|
1285
1352
|
*/
|
|
1286
|
-
exports.CallToolRequestParamsSchema =
|
|
1353
|
+
exports.CallToolRequestParamsSchema = exports.TaskAugmentedRequestParamsSchema.extend({
|
|
1287
1354
|
/**
|
|
1288
1355
|
* The name of the tool to call.
|
|
1289
1356
|
*/
|
|
@@ -1291,7 +1358,7 @@ exports.CallToolRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
|
1291
1358
|
/**
|
|
1292
1359
|
* Arguments to pass to the tool.
|
|
1293
1360
|
*/
|
|
1294
|
-
arguments: z.
|
|
1361
|
+
arguments: z.record(z.string(), z.unknown()).optional()
|
|
1295
1362
|
});
|
|
1296
1363
|
/**
|
|
1297
1364
|
* Used by the client to invoke a tool provided by the server.
|
|
@@ -1304,7 +1371,32 @@ exports.CallToolRequestSchema = exports.RequestSchema.extend({
|
|
|
1304
1371
|
* An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.
|
|
1305
1372
|
*/
|
|
1306
1373
|
exports.ToolListChangedNotificationSchema = exports.NotificationSchema.extend({
|
|
1307
|
-
method: z.literal('notifications/tools/list_changed')
|
|
1374
|
+
method: z.literal('notifications/tools/list_changed'),
|
|
1375
|
+
params: NotificationsParamsSchema.optional()
|
|
1376
|
+
});
|
|
1377
|
+
/**
|
|
1378
|
+
* Base schema for list changed subscription options (without callback).
|
|
1379
|
+
* Used internally for Zod validation of autoRefresh and debounceMs.
|
|
1380
|
+
*/
|
|
1381
|
+
exports.ListChangedOptionsBaseSchema = z.object({
|
|
1382
|
+
/**
|
|
1383
|
+
* If true, the list will be refreshed automatically when a list changed notification is received.
|
|
1384
|
+
* The callback will be called with the updated list.
|
|
1385
|
+
*
|
|
1386
|
+
* If false, the callback will be called with null items, allowing manual refresh.
|
|
1387
|
+
*
|
|
1388
|
+
* @default true
|
|
1389
|
+
*/
|
|
1390
|
+
autoRefresh: z.boolean().default(true),
|
|
1391
|
+
/**
|
|
1392
|
+
* Debounce time in milliseconds for list changed notification processing.
|
|
1393
|
+
*
|
|
1394
|
+
* Multiple notifications received within this timeframe will only trigger one refresh.
|
|
1395
|
+
* Set to 0 to disable debouncing.
|
|
1396
|
+
*
|
|
1397
|
+
* @default 300
|
|
1398
|
+
*/
|
|
1399
|
+
debounceMs: z.number().int().nonnegative().default(300)
|
|
1308
1400
|
});
|
|
1309
1401
|
/* Logging */
|
|
1310
1402
|
/**
|
|
@@ -1368,19 +1460,19 @@ exports.ModelPreferencesSchema = z.object({
|
|
|
1368
1460
|
/**
|
|
1369
1461
|
* Optional hints to use for model selection.
|
|
1370
1462
|
*/
|
|
1371
|
-
hints: z.
|
|
1463
|
+
hints: z.array(exports.ModelHintSchema).optional(),
|
|
1372
1464
|
/**
|
|
1373
1465
|
* How much to prioritize cost when selecting a model.
|
|
1374
1466
|
*/
|
|
1375
|
-
costPriority: z.
|
|
1467
|
+
costPriority: z.number().min(0).max(1).optional(),
|
|
1376
1468
|
/**
|
|
1377
1469
|
* How much to prioritize sampling speed (latency) when selecting a model.
|
|
1378
1470
|
*/
|
|
1379
|
-
speedPriority: z.
|
|
1471
|
+
speedPriority: z.number().min(0).max(1).optional(),
|
|
1380
1472
|
/**
|
|
1381
1473
|
* How much to prioritize intelligence and capabilities when selecting a model.
|
|
1382
1474
|
*/
|
|
1383
|
-
intelligencePriority: z.
|
|
1475
|
+
intelligencePriority: z.number().min(0).max(1).optional()
|
|
1384
1476
|
});
|
|
1385
1477
|
/**
|
|
1386
1478
|
* Controls tool usage behavior in sampling requests.
|
|
@@ -1392,26 +1484,24 @@ exports.ToolChoiceSchema = z.object({
|
|
|
1392
1484
|
* - "required": Model MUST use at least one tool before completing
|
|
1393
1485
|
* - "none": Model MUST NOT use any tools
|
|
1394
1486
|
*/
|
|
1395
|
-
mode: z.
|
|
1487
|
+
mode: z.enum(['auto', 'required', 'none']).optional()
|
|
1396
1488
|
});
|
|
1397
1489
|
/**
|
|
1398
1490
|
* The result of a tool execution, provided by the user (server).
|
|
1399
1491
|
* Represents the outcome of invoking a tool requested via ToolUseContent.
|
|
1400
1492
|
*/
|
|
1401
|
-
exports.ToolResultContentSchema = z
|
|
1402
|
-
.object({
|
|
1493
|
+
exports.ToolResultContentSchema = z.object({
|
|
1403
1494
|
type: z.literal('tool_result'),
|
|
1404
1495
|
toolUseId: z.string().describe('The unique identifier for the corresponding tool call.'),
|
|
1405
1496
|
content: z.array(exports.ContentBlockSchema).default([]),
|
|
1406
|
-
structuredContent: z.object({}).
|
|
1407
|
-
isError: z.
|
|
1497
|
+
structuredContent: z.object({}).loose().optional(),
|
|
1498
|
+
isError: z.boolean().optional(),
|
|
1408
1499
|
/**
|
|
1409
1500
|
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
1410
1501
|
* for notes on _meta usage.
|
|
1411
1502
|
*/
|
|
1412
|
-
_meta: z.
|
|
1413
|
-
})
|
|
1414
|
-
.passthrough();
|
|
1503
|
+
_meta: z.record(z.string(), z.unknown()).optional()
|
|
1504
|
+
});
|
|
1415
1505
|
/**
|
|
1416
1506
|
* Basic content types for sampling responses (without tool use).
|
|
1417
1507
|
* Used for backwards-compatible CreateMessageResult when tools are not used.
|
|
@@ -1431,21 +1521,19 @@ exports.SamplingMessageContentBlockSchema = z.discriminatedUnion('type', [
|
|
|
1431
1521
|
/**
|
|
1432
1522
|
* Describes a message issued to or received from an LLM API.
|
|
1433
1523
|
*/
|
|
1434
|
-
exports.SamplingMessageSchema = z
|
|
1435
|
-
.
|
|
1436
|
-
role: z.enum(['user', 'assistant']),
|
|
1524
|
+
exports.SamplingMessageSchema = z.object({
|
|
1525
|
+
role: exports.RoleSchema,
|
|
1437
1526
|
content: z.union([exports.SamplingMessageContentBlockSchema, z.array(exports.SamplingMessageContentBlockSchema)]),
|
|
1438
1527
|
/**
|
|
1439
1528
|
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
1440
1529
|
* for notes on _meta usage.
|
|
1441
1530
|
*/
|
|
1442
|
-
_meta: z.
|
|
1443
|
-
})
|
|
1444
|
-
.passthrough();
|
|
1531
|
+
_meta: z.record(z.string(), z.unknown()).optional()
|
|
1532
|
+
});
|
|
1445
1533
|
/**
|
|
1446
1534
|
* Parameters for a `sampling/createMessage` request.
|
|
1447
1535
|
*/
|
|
1448
|
-
exports.CreateMessageRequestParamsSchema =
|
|
1536
|
+
exports.CreateMessageRequestParamsSchema = exports.TaskAugmentedRequestParamsSchema.extend({
|
|
1449
1537
|
messages: z.array(exports.SamplingMessageSchema),
|
|
1450
1538
|
/**
|
|
1451
1539
|
* The server's preferences for which model to select. The client MAY modify or omit this request.
|
|
@@ -1479,13 +1567,13 @@ exports.CreateMessageRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
|
1479
1567
|
* Tools that the model may use during generation.
|
|
1480
1568
|
* The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
|
|
1481
1569
|
*/
|
|
1482
|
-
tools: z.
|
|
1570
|
+
tools: z.array(exports.ToolSchema).optional(),
|
|
1483
1571
|
/**
|
|
1484
1572
|
* Controls how the model uses tools.
|
|
1485
1573
|
* The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
|
|
1486
1574
|
* Default is `{ mode: "auto" }`.
|
|
1487
1575
|
*/
|
|
1488
|
-
toolChoice:
|
|
1576
|
+
toolChoice: exports.ToolChoiceSchema.optional()
|
|
1489
1577
|
});
|
|
1490
1578
|
/**
|
|
1491
1579
|
* A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.
|
|
@@ -1515,7 +1603,7 @@ exports.CreateMessageResultSchema = exports.ResultSchema.extend({
|
|
|
1515
1603
|
* This field is an open string to allow for provider-specific stop reasons.
|
|
1516
1604
|
*/
|
|
1517
1605
|
stopReason: z.optional(z.enum(['endTurn', 'stopSequence', 'maxTokens']).or(z.string())),
|
|
1518
|
-
role:
|
|
1606
|
+
role: exports.RoleSchema,
|
|
1519
1607
|
/**
|
|
1520
1608
|
* Response content. Single content block (text, image, or audio).
|
|
1521
1609
|
*/
|
|
@@ -1542,7 +1630,7 @@ exports.CreateMessageResultWithToolsSchema = exports.ResultSchema.extend({
|
|
|
1542
1630
|
* This field is an open string to allow for provider-specific stop reasons.
|
|
1543
1631
|
*/
|
|
1544
1632
|
stopReason: z.optional(z.enum(['endTurn', 'stopSequence', 'maxTokens', 'toolUse']).or(z.string())),
|
|
1545
|
-
role:
|
|
1633
|
+
role: exports.RoleSchema,
|
|
1546
1634
|
/**
|
|
1547
1635
|
* Response content. May be a single block or array. May include ToolUseContent if stopReason is "toolUse".
|
|
1548
1636
|
*/
|
|
@@ -1665,7 +1753,7 @@ exports.PrimitiveSchemaDefinitionSchema = z.union([exports.EnumSchemaSchema, exp
|
|
|
1665
1753
|
/**
|
|
1666
1754
|
* Parameters for an `elicitation/create` request for form-based elicitation.
|
|
1667
1755
|
*/
|
|
1668
|
-
exports.ElicitRequestFormParamsSchema =
|
|
1756
|
+
exports.ElicitRequestFormParamsSchema = exports.TaskAugmentedRequestParamsSchema.extend({
|
|
1669
1757
|
/**
|
|
1670
1758
|
* The elicitation mode.
|
|
1671
1759
|
*
|
|
@@ -1689,7 +1777,7 @@ exports.ElicitRequestFormParamsSchema = BaseRequestParamsSchema.extend({
|
|
|
1689
1777
|
/**
|
|
1690
1778
|
* Parameters for an `elicitation/create` request for URL-based elicitation.
|
|
1691
1779
|
*/
|
|
1692
|
-
exports.ElicitRequestURLParamsSchema =
|
|
1780
|
+
exports.ElicitRequestURLParamsSchema = exports.TaskAugmentedRequestParamsSchema.extend({
|
|
1693
1781
|
/**
|
|
1694
1782
|
* The elicitation mode.
|
|
1695
1783
|
*/
|
|
@@ -1873,7 +1961,8 @@ exports.RootSchema = z.object({
|
|
|
1873
1961
|
* Sent from the server to request a list of root URIs from the client.
|
|
1874
1962
|
*/
|
|
1875
1963
|
exports.ListRootsRequestSchema = exports.RequestSchema.extend({
|
|
1876
|
-
method: z.literal('roots/list')
|
|
1964
|
+
method: z.literal('roots/list'),
|
|
1965
|
+
params: BaseRequestParamsSchema.optional()
|
|
1877
1966
|
});
|
|
1878
1967
|
/**
|
|
1879
1968
|
* The client's response to a roots/list request from the server.
|
|
@@ -1885,7 +1974,8 @@ exports.ListRootsResultSchema = exports.ResultSchema.extend({
|
|
|
1885
1974
|
* A notification from the client to the server, informing it that the list of roots has changed.
|
|
1886
1975
|
*/
|
|
1887
1976
|
exports.RootsListChangedNotificationSchema = exports.NotificationSchema.extend({
|
|
1888
|
-
method: z.literal('notifications/roots/list_changed')
|
|
1977
|
+
method: z.literal('notifications/roots/list_changed'),
|
|
1978
|
+
params: NotificationsParamsSchema.optional()
|
|
1889
1979
|
});
|
|
1890
1980
|
/* Client messages */
|
|
1891
1981
|
exports.ClientRequestSchema = z.union([
|
|
@@ -1904,7 +1994,8 @@ exports.ClientRequestSchema = z.union([
|
|
|
1904
1994
|
exports.ListToolsRequestSchema,
|
|
1905
1995
|
exports.GetTaskRequestSchema,
|
|
1906
1996
|
exports.GetTaskPayloadRequestSchema,
|
|
1907
|
-
exports.ListTasksRequestSchema
|
|
1997
|
+
exports.ListTasksRequestSchema,
|
|
1998
|
+
exports.CancelTaskRequestSchema
|
|
1908
1999
|
]);
|
|
1909
2000
|
exports.ClientNotificationSchema = z.union([
|
|
1910
2001
|
exports.CancelledNotificationSchema,
|
|
@@ -1931,7 +2022,8 @@ exports.ServerRequestSchema = z.union([
|
|
|
1931
2022
|
exports.ListRootsRequestSchema,
|
|
1932
2023
|
exports.GetTaskRequestSchema,
|
|
1933
2024
|
exports.GetTaskPayloadRequestSchema,
|
|
1934
|
-
exports.ListTasksRequestSchema
|
|
2025
|
+
exports.ListTasksRequestSchema,
|
|
2026
|
+
exports.CancelTaskRequestSchema
|
|
1935
2027
|
]);
|
|
1936
2028
|
exports.ServerNotificationSchema = z.union([
|
|
1937
2029
|
exports.CancelledNotificationSchema,
|
|
@@ -1993,8 +2085,7 @@ class UrlElicitationRequiredError extends McpError {
|
|
|
1993
2085
|
});
|
|
1994
2086
|
}
|
|
1995
2087
|
get elicitations() {
|
|
1996
|
-
|
|
1997
|
-
return (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.elicitations) !== null && _b !== void 0 ? _b : [];
|
|
2088
|
+
return this.data?.elicitations ?? [];
|
|
1998
2089
|
}
|
|
1999
2090
|
}
|
|
2000
2091
|
exports.UrlElicitationRequiredError = UrlElicitationRequiredError;
|