@spotlightjs/spotlight 4.11.0 → 4.11.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/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js +5 -3
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js +224 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +1 -0
- package/dist/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +13 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -0
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +1 -0
- package/dist/sentry-config.js +2 -2
- package/dist/server/cli/mcp.js +3 -3
- package/dist/server/cli/run.js +2 -2
- package/dist/server/cli.js +2 -2
- package/dist/server/mcp/mcp.js +3 -3
- package/dist/ui/assets/instrumentation.js +2 -2
- package/package.json +2 -2
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js +0 -82
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +0 -1
- package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +0 -1
- /package/dist/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js +0 -0
- /package/dist/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js +0 -0
- /package/dist/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js +0 -0
- /package/dist/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js +0 -0
- /package/dist/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js +0 -0
- /package/dist/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +0 -0
- /package/dist/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +0 -0
- /package/dist/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js +0 -0
- /package/dist/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +0 -0
- /package/dist/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +0 -0
- /package/dist/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js +0 -0
- /package/dist/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js +0 -0
- /package/dist/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +0 -0
- /package/dist/node_modules/.pnpm/{@modelcontextprotocol_sdk@1.25.2_hono@4.12.8_zod@4.1.13 → @modelcontextprotocol_sdk@1.27.1_zod@4.1.13}/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spotlightjs/spotlight",
|
|
3
3
|
"description": "Spotlight - Sentry for development. Containing the UI, sidecar, and electron app.",
|
|
4
|
-
"version": "4.11.
|
|
4
|
+
"version": "4.11.1",
|
|
5
5
|
"productName": "Spotlight",
|
|
6
6
|
"author": "Sentry",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@hono/mcp": "^0.2.2",
|
|
35
35
|
"@hono/node-server": "^1.19.10",
|
|
36
36
|
"@jridgewell/trace-mapping": "^0.3.25",
|
|
37
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
37
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
38
38
|
"@sentry/core": "^10.31.0",
|
|
39
39
|
"@sentry/node": "^10.31.0",
|
|
40
40
|
"anser": "^2.3.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../../../../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js"],"sourcesContent":["import { mergeCapabilities, Protocol } from '../shared/protocol.js';\nimport { CallToolResultSchema, CompleteResultSchema, EmptyResultSchema, ErrorCode, GetPromptResultSchema, InitializeResultSchema, LATEST_PROTOCOL_VERSION, ListPromptsResultSchema, ListResourcesResultSchema, ListResourceTemplatesResultSchema, ListToolsResultSchema, McpError, ReadResourceResultSchema, SUPPORTED_PROTOCOL_VERSIONS, ElicitResultSchema, ElicitRequestSchema, CreateTaskResultSchema, CreateMessageRequestSchema, CreateMessageResultSchema, ToolListChangedNotificationSchema, PromptListChangedNotificationSchema, ResourceListChangedNotificationSchema, ListChangedOptionsBaseSchema } from '../types.js';\nimport { AjvJsonSchemaValidator } from '../validation/ajv-provider.js';\nimport { getObjectShape, isZ4Schema, safeParse } from '../server/zod-compat.js';\nimport { ExperimentalClientTasks } from '../experimental/tasks/client.js';\nimport { assertToolsCallTaskCapability, assertClientRequestTaskCapability } from '../experimental/tasks/helpers.js';\n/**\n * Elicitation default application helper. Applies defaults to the data based on the schema.\n *\n * @param schema - The schema to apply defaults to.\n * @param data - The data to apply defaults to.\n */\nfunction applyElicitationDefaults(schema, data) {\n if (!schema || data === null || typeof data !== 'object')\n return;\n // Handle object properties\n if (schema.type === 'object' && schema.properties && typeof schema.properties === 'object') {\n const obj = data;\n const props = schema.properties;\n for (const key of Object.keys(props)) {\n const propSchema = props[key];\n // If missing or explicitly undefined, apply default if present\n if (obj[key] === undefined && Object.prototype.hasOwnProperty.call(propSchema, 'default')) {\n obj[key] = propSchema.default;\n }\n // Recurse into existing nested objects/arrays\n if (obj[key] !== undefined) {\n applyElicitationDefaults(propSchema, obj[key]);\n }\n }\n }\n if (Array.isArray(schema.anyOf)) {\n for (const sub of schema.anyOf) {\n // Skip boolean schemas (true/false are valid JSON Schemas but have no defaults)\n if (typeof sub !== 'boolean') {\n applyElicitationDefaults(sub, data);\n }\n }\n }\n // Combine schemas\n if (Array.isArray(schema.oneOf)) {\n for (const sub of schema.oneOf) {\n // Skip boolean schemas (true/false are valid JSON Schemas but have no defaults)\n if (typeof sub !== 'boolean') {\n applyElicitationDefaults(sub, data);\n }\n }\n }\n}\n/**\n * Determines which elicitation modes are supported based on declared client capabilities.\n *\n * According to the spec:\n * - An empty elicitation capability object defaults to form mode support (backwards compatibility)\n * - URL mode is only supported if explicitly declared\n *\n * @param capabilities - The client's elicitation capabilities\n * @returns An object indicating which modes are supported\n */\nexport function getSupportedElicitationModes(capabilities) {\n if (!capabilities) {\n return { supportsFormMode: false, supportsUrlMode: false };\n }\n const hasFormCapability = capabilities.form !== undefined;\n const hasUrlCapability = capabilities.url !== undefined;\n // If neither form nor url are explicitly declared, form mode is supported (backwards compatibility)\n const supportsFormMode = hasFormCapability || (!hasFormCapability && !hasUrlCapability);\n const supportsUrlMode = hasUrlCapability;\n return { supportsFormMode, supportsUrlMode };\n}\n/**\n * An MCP client on top of a pluggable transport.\n *\n * The client will automatically begin the initialization flow with the server when connect() is called.\n *\n * To use with custom types, extend the base Request/Notification/Result types and pass them as type parameters:\n *\n * ```typescript\n * // Custom schemas\n * const CustomRequestSchema = RequestSchema.extend({...})\n * const CustomNotificationSchema = NotificationSchema.extend({...})\n * const CustomResultSchema = ResultSchema.extend({...})\n *\n * // Type aliases\n * type CustomRequest = z.infer<typeof CustomRequestSchema>\n * type CustomNotification = z.infer<typeof CustomNotificationSchema>\n * type CustomResult = z.infer<typeof CustomResultSchema>\n *\n * // Create typed client\n * const client = new Client<CustomRequest, CustomNotification, CustomResult>({\n * name: \"CustomClient\",\n * version: \"1.0.0\"\n * })\n * ```\n */\nexport class Client extends Protocol {\n /**\n * Initializes this client with the given name and version information.\n */\n constructor(_clientInfo, options) {\n super(options);\n this._clientInfo = _clientInfo;\n this._cachedToolOutputValidators = new Map();\n this._cachedKnownTaskTools = new Set();\n this._cachedRequiredTaskTools = new Set();\n this._listChangedDebounceTimers = new Map();\n this._capabilities = options?.capabilities ?? {};\n this._jsonSchemaValidator = options?.jsonSchemaValidator ?? new AjvJsonSchemaValidator();\n // Store list changed config for setup after connection (when we know server capabilities)\n if (options?.listChanged) {\n this._pendingListChangedConfig = options.listChanged;\n }\n }\n /**\n * Set up handlers for list changed notifications based on config and server capabilities.\n * This should only be called after initialization when server capabilities are known.\n * Handlers are silently skipped if the server doesn't advertise the corresponding listChanged capability.\n * @internal\n */\n _setupListChangedHandlers(config) {\n if (config.tools && this._serverCapabilities?.tools?.listChanged) {\n this._setupListChangedHandler('tools', ToolListChangedNotificationSchema, config.tools, async () => {\n const result = await this.listTools();\n return result.tools;\n });\n }\n if (config.prompts && this._serverCapabilities?.prompts?.listChanged) {\n this._setupListChangedHandler('prompts', PromptListChangedNotificationSchema, config.prompts, async () => {\n const result = await this.listPrompts();\n return result.prompts;\n });\n }\n if (config.resources && this._serverCapabilities?.resources?.listChanged) {\n this._setupListChangedHandler('resources', ResourceListChangedNotificationSchema, config.resources, async () => {\n const result = await this.listResources();\n return result.resources;\n });\n }\n }\n /**\n * Access experimental features.\n *\n * WARNING: These APIs are experimental and may change without notice.\n *\n * @experimental\n */\n get experimental() {\n if (!this._experimental) {\n this._experimental = {\n tasks: new ExperimentalClientTasks(this)\n };\n }\n return this._experimental;\n }\n /**\n * Registers new capabilities. This can only be called before connecting to a transport.\n *\n * The new capabilities will be merged with any existing capabilities previously given (e.g., at initialization).\n */\n registerCapabilities(capabilities) {\n if (this.transport) {\n throw new Error('Cannot register capabilities after connecting to transport');\n }\n this._capabilities = mergeCapabilities(this._capabilities, capabilities);\n }\n /**\n * Override request handler registration to enforce client-side validation for elicitation.\n */\n setRequestHandler(requestSchema, handler) {\n const shape = getObjectShape(requestSchema);\n const methodSchema = shape?.method;\n if (!methodSchema) {\n throw new Error('Schema is missing a method literal');\n }\n // Extract literal value using type-safe property access\n let methodValue;\n if (isZ4Schema(methodSchema)) {\n const v4Schema = methodSchema;\n const v4Def = v4Schema._zod?.def;\n methodValue = v4Def?.value ?? v4Schema.value;\n }\n else {\n const v3Schema = methodSchema;\n const legacyDef = v3Schema._def;\n methodValue = legacyDef?.value ?? v3Schema.value;\n }\n if (typeof methodValue !== 'string') {\n throw new Error('Schema method literal must be a string');\n }\n const method = methodValue;\n if (method === 'elicitation/create') {\n const wrappedHandler = async (request, extra) => {\n const validatedRequest = safeParse(ElicitRequestSchema, request);\n if (!validatedRequest.success) {\n // Type guard: if success is false, error is guaranteed to exist\n const errorMessage = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);\n throw new McpError(ErrorCode.InvalidParams, `Invalid elicitation request: ${errorMessage}`);\n }\n const { params } = validatedRequest.data;\n params.mode = params.mode ?? 'form';\n const { supportsFormMode, supportsUrlMode } = getSupportedElicitationModes(this._capabilities.elicitation);\n if (params.mode === 'form' && !supportsFormMode) {\n throw new McpError(ErrorCode.InvalidParams, 'Client does not support form-mode elicitation requests');\n }\n if (params.mode === 'url' && !supportsUrlMode) {\n throw new McpError(ErrorCode.InvalidParams, 'Client does not support URL-mode elicitation requests');\n }\n const result = await Promise.resolve(handler(request, extra));\n // When task creation is requested, validate and return CreateTaskResult\n if (params.task) {\n const taskValidationResult = safeParse(CreateTaskResultSchema, result);\n if (!taskValidationResult.success) {\n const errorMessage = taskValidationResult.error instanceof Error\n ? taskValidationResult.error.message\n : String(taskValidationResult.error);\n throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage}`);\n }\n return taskValidationResult.data;\n }\n // For non-task requests, validate against ElicitResultSchema\n const validationResult = safeParse(ElicitResultSchema, result);\n if (!validationResult.success) {\n // Type guard: if success is false, error is guaranteed to exist\n const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);\n throw new McpError(ErrorCode.InvalidParams, `Invalid elicitation result: ${errorMessage}`);\n }\n const validatedResult = validationResult.data;\n const requestedSchema = params.mode === 'form' ? params.requestedSchema : undefined;\n if (params.mode === 'form' && validatedResult.action === 'accept' && validatedResult.content && requestedSchema) {\n if (this._capabilities.elicitation?.form?.applyDefaults) {\n try {\n applyElicitationDefaults(requestedSchema, validatedResult.content);\n }\n catch {\n // gracefully ignore errors in default application\n }\n }\n }\n return validatedResult;\n };\n // Install the wrapped handler\n return super.setRequestHandler(requestSchema, wrappedHandler);\n }\n if (method === 'sampling/createMessage') {\n const wrappedHandler = async (request, extra) => {\n const validatedRequest = safeParse(CreateMessageRequestSchema, request);\n if (!validatedRequest.success) {\n const errorMessage = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);\n throw new McpError(ErrorCode.InvalidParams, `Invalid sampling request: ${errorMessage}`);\n }\n const { params } = validatedRequest.data;\n const result = await Promise.resolve(handler(request, extra));\n // When task creation is requested, validate and return CreateTaskResult\n if (params.task) {\n const taskValidationResult = safeParse(CreateTaskResultSchema, result);\n if (!taskValidationResult.success) {\n const errorMessage = taskValidationResult.error instanceof Error\n ? taskValidationResult.error.message\n : String(taskValidationResult.error);\n throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage}`);\n }\n return taskValidationResult.data;\n }\n // For non-task requests, validate against CreateMessageResultSchema\n const validationResult = safeParse(CreateMessageResultSchema, result);\n if (!validationResult.success) {\n const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);\n throw new McpError(ErrorCode.InvalidParams, `Invalid sampling result: ${errorMessage}`);\n }\n return validationResult.data;\n };\n // Install the wrapped handler\n return super.setRequestHandler(requestSchema, wrappedHandler);\n }\n // Other handlers use default behavior\n return super.setRequestHandler(requestSchema, handler);\n }\n assertCapability(capability, method) {\n if (!this._serverCapabilities?.[capability]) {\n throw new Error(`Server does not support ${capability} (required for ${method})`);\n }\n }\n async connect(transport, options) {\n await super.connect(transport);\n // When transport sessionId is already set this means we are trying to reconnect.\n // In this case we don't need to initialize again.\n if (transport.sessionId !== undefined) {\n return;\n }\n try {\n const result = await this.request({\n method: 'initialize',\n params: {\n protocolVersion: LATEST_PROTOCOL_VERSION,\n capabilities: this._capabilities,\n clientInfo: this._clientInfo\n }\n }, InitializeResultSchema, options);\n if (result === undefined) {\n throw new Error(`Server sent invalid initialize result: ${result}`);\n }\n if (!SUPPORTED_PROTOCOL_VERSIONS.includes(result.protocolVersion)) {\n throw new Error(`Server's protocol version is not supported: ${result.protocolVersion}`);\n }\n this._serverCapabilities = result.capabilities;\n this._serverVersion = result.serverInfo;\n // HTTP transports must set the protocol version in each header after initialization.\n if (transport.setProtocolVersion) {\n transport.setProtocolVersion(result.protocolVersion);\n }\n this._instructions = result.instructions;\n await this.notification({\n method: 'notifications/initialized'\n });\n // Set up list changed handlers now that we know server capabilities\n if (this._pendingListChangedConfig) {\n this._setupListChangedHandlers(this._pendingListChangedConfig);\n this._pendingListChangedConfig = undefined;\n }\n }\n catch (error) {\n // Disconnect if initialization fails.\n void this.close();\n throw error;\n }\n }\n /**\n * After initialization has completed, this will be populated with the server's reported capabilities.\n */\n getServerCapabilities() {\n return this._serverCapabilities;\n }\n /**\n * After initialization has completed, this will be populated with information about the server's name and version.\n */\n getServerVersion() {\n return this._serverVersion;\n }\n /**\n * After initialization has completed, this may be populated with information about the server's instructions.\n */\n getInstructions() {\n return this._instructions;\n }\n assertCapabilityForMethod(method) {\n switch (method) {\n case 'logging/setLevel':\n if (!this._serverCapabilities?.logging) {\n throw new Error(`Server does not support logging (required for ${method})`);\n }\n break;\n case 'prompts/get':\n case 'prompts/list':\n if (!this._serverCapabilities?.prompts) {\n throw new Error(`Server does not support prompts (required for ${method})`);\n }\n break;\n case 'resources/list':\n case 'resources/templates/list':\n case 'resources/read':\n case 'resources/subscribe':\n case 'resources/unsubscribe':\n if (!this._serverCapabilities?.resources) {\n throw new Error(`Server does not support resources (required for ${method})`);\n }\n if (method === 'resources/subscribe' && !this._serverCapabilities.resources.subscribe) {\n throw new Error(`Server does not support resource subscriptions (required for ${method})`);\n }\n break;\n case 'tools/call':\n case 'tools/list':\n if (!this._serverCapabilities?.tools) {\n throw new Error(`Server does not support tools (required for ${method})`);\n }\n break;\n case 'completion/complete':\n if (!this._serverCapabilities?.completions) {\n throw new Error(`Server does not support completions (required for ${method})`);\n }\n break;\n case 'initialize':\n // No specific capability required for initialize\n break;\n case 'ping':\n // No specific capability required for ping\n break;\n }\n }\n assertNotificationCapability(method) {\n switch (method) {\n case 'notifications/roots/list_changed':\n if (!this._capabilities.roots?.listChanged) {\n throw new Error(`Client does not support roots list changed notifications (required for ${method})`);\n }\n break;\n case 'notifications/initialized':\n // No specific capability required for initialized\n break;\n case 'notifications/cancelled':\n // Cancellation notifications are always allowed\n break;\n case 'notifications/progress':\n // Progress notifications are always allowed\n break;\n }\n }\n assertRequestHandlerCapability(method) {\n // Task handlers are registered in Protocol constructor before _capabilities is initialized\n // Skip capability check for task methods during initialization\n if (!this._capabilities) {\n return;\n }\n switch (method) {\n case 'sampling/createMessage':\n if (!this._capabilities.sampling) {\n throw new Error(`Client does not support sampling capability (required for ${method})`);\n }\n break;\n case 'elicitation/create':\n if (!this._capabilities.elicitation) {\n throw new Error(`Client does not support elicitation capability (required for ${method})`);\n }\n break;\n case 'roots/list':\n if (!this._capabilities.roots) {\n throw new Error(`Client does not support roots capability (required for ${method})`);\n }\n break;\n case 'tasks/get':\n case 'tasks/list':\n case 'tasks/result':\n case 'tasks/cancel':\n if (!this._capabilities.tasks) {\n throw new Error(`Client does not support tasks capability (required for ${method})`);\n }\n break;\n case 'ping':\n // No specific capability required for ping\n break;\n }\n }\n assertTaskCapability(method) {\n assertToolsCallTaskCapability(this._serverCapabilities?.tasks?.requests, method, 'Server');\n }\n assertTaskHandlerCapability(method) {\n // Task handlers are registered in Protocol constructor before _capabilities is initialized\n // Skip capability check for task methods during initialization\n if (!this._capabilities) {\n return;\n }\n assertClientRequestTaskCapability(this._capabilities.tasks?.requests, method, 'Client');\n }\n async ping(options) {\n return this.request({ method: 'ping' }, EmptyResultSchema, options);\n }\n async complete(params, options) {\n return this.request({ method: 'completion/complete', params }, CompleteResultSchema, options);\n }\n async setLoggingLevel(level, options) {\n return this.request({ method: 'logging/setLevel', params: { level } }, EmptyResultSchema, options);\n }\n async getPrompt(params, options) {\n return this.request({ method: 'prompts/get', params }, GetPromptResultSchema, options);\n }\n async listPrompts(params, options) {\n return this.request({ method: 'prompts/list', params }, ListPromptsResultSchema, options);\n }\n async listResources(params, options) {\n return this.request({ method: 'resources/list', params }, ListResourcesResultSchema, options);\n }\n async listResourceTemplates(params, options) {\n return this.request({ method: 'resources/templates/list', params }, ListResourceTemplatesResultSchema, options);\n }\n async readResource(params, options) {\n return this.request({ method: 'resources/read', params }, ReadResourceResultSchema, options);\n }\n async subscribeResource(params, options) {\n return this.request({ method: 'resources/subscribe', params }, EmptyResultSchema, options);\n }\n async unsubscribeResource(params, options) {\n return this.request({ method: 'resources/unsubscribe', params }, EmptyResultSchema, options);\n }\n /**\n * Calls a tool and waits for the result. Automatically validates structured output if the tool has an outputSchema.\n *\n * For task-based execution with streaming behavior, use client.experimental.tasks.callToolStream() instead.\n */\n async callTool(params, resultSchema = CallToolResultSchema, options) {\n // Guard: required-task tools need experimental API\n if (this.isToolTaskRequired(params.name)) {\n throw new McpError(ErrorCode.InvalidRequest, `Tool \"${params.name}\" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);\n }\n const result = await this.request({ method: 'tools/call', params }, resultSchema, options);\n // Check if the tool has an outputSchema\n const validator = this.getToolOutputValidator(params.name);\n if (validator) {\n // If tool has outputSchema, it MUST return structuredContent (unless it's an error)\n if (!result.structuredContent && !result.isError) {\n throw new McpError(ErrorCode.InvalidRequest, `Tool ${params.name} has an output schema but did not return structured content`);\n }\n // Only validate structured content if present (not when there's an error)\n if (result.structuredContent) {\n try {\n // Validate the structured content against the schema\n const validationResult = validator(result.structuredContent);\n if (!validationResult.valid) {\n throw new McpError(ErrorCode.InvalidParams, `Structured content does not match the tool's output schema: ${validationResult.errorMessage}`);\n }\n }\n catch (error) {\n if (error instanceof McpError) {\n throw error;\n }\n throw new McpError(ErrorCode.InvalidParams, `Failed to validate structured content: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n }\n return result;\n }\n isToolTask(toolName) {\n if (!this._serverCapabilities?.tasks?.requests?.tools?.call) {\n return false;\n }\n return this._cachedKnownTaskTools.has(toolName);\n }\n /**\n * Check if a tool requires task-based execution.\n * Unlike isToolTask which includes 'optional' tools, this only checks for 'required'.\n */\n isToolTaskRequired(toolName) {\n return this._cachedRequiredTaskTools.has(toolName);\n }\n /**\n * Cache validators for tool output schemas.\n * Called after listTools() to pre-compile validators for better performance.\n */\n cacheToolMetadata(tools) {\n this._cachedToolOutputValidators.clear();\n this._cachedKnownTaskTools.clear();\n this._cachedRequiredTaskTools.clear();\n for (const tool of tools) {\n // If the tool has an outputSchema, create and cache the validator\n if (tool.outputSchema) {\n const toolValidator = this._jsonSchemaValidator.getValidator(tool.outputSchema);\n this._cachedToolOutputValidators.set(tool.name, toolValidator);\n }\n // If the tool supports task-based execution, cache that information\n const taskSupport = tool.execution?.taskSupport;\n if (taskSupport === 'required' || taskSupport === 'optional') {\n this._cachedKnownTaskTools.add(tool.name);\n }\n if (taskSupport === 'required') {\n this._cachedRequiredTaskTools.add(tool.name);\n }\n }\n }\n /**\n * Get cached validator for a tool\n */\n getToolOutputValidator(toolName) {\n return this._cachedToolOutputValidators.get(toolName);\n }\n async listTools(params, options) {\n const result = await this.request({ method: 'tools/list', params }, ListToolsResultSchema, options);\n // Cache the tools and their output schemas for future validation\n this.cacheToolMetadata(result.tools);\n return result;\n }\n /**\n * Set up a single list changed handler.\n * @internal\n */\n _setupListChangedHandler(listType, notificationSchema, options, fetcher) {\n // Validate options using Zod schema (validates autoRefresh and debounceMs)\n const parseResult = ListChangedOptionsBaseSchema.safeParse(options);\n if (!parseResult.success) {\n throw new Error(`Invalid ${listType} listChanged options: ${parseResult.error.message}`);\n }\n // Validate callback\n if (typeof options.onChanged !== 'function') {\n throw new Error(`Invalid ${listType} listChanged options: onChanged must be a function`);\n }\n const { autoRefresh, debounceMs } = parseResult.data;\n const { onChanged } = options;\n const refresh = async () => {\n if (!autoRefresh) {\n onChanged(null, null);\n return;\n }\n try {\n const items = await fetcher();\n onChanged(null, items);\n }\n catch (e) {\n const error = e instanceof Error ? e : new Error(String(e));\n onChanged(error, null);\n }\n };\n const handler = () => {\n if (debounceMs) {\n // Clear any pending debounce timer for this list type\n const existingTimer = this._listChangedDebounceTimers.get(listType);\n if (existingTimer) {\n clearTimeout(existingTimer);\n }\n // Set up debounced refresh\n const timer = setTimeout(refresh, debounceMs);\n this._listChangedDebounceTimers.set(listType, timer);\n }\n else {\n // No debounce, refresh immediately\n refresh();\n }\n };\n // Register notification handler\n this.setNotificationHandler(notificationSchema, handler);\n }\n async sendRootsListChanged() {\n return this.notification({ method: 'notifications/roots/list_changed' });\n }\n}\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;;;;;;;;;;AAYA,SAAS,yBAAyB,QAAQ,MAAM;AAC5C,MAAI,CAAC,UAAU,SAAS,QAAQ,OAAO,SAAS;AAC5C;AAEJ,MAAI,OAAO,SAAS,YAAY,OAAO,cAAc,OAAO,OAAO,eAAe,UAAU;AACxF,UAAM,MAAM;AACZ,UAAM,QAAQ,OAAO;AACrB,eAAW,OAAO,OAAO,KAAK,KAAK,GAAG;AAClC,YAAM,aAAa,MAAM,GAAG;AAE5B,UAAI,IAAI,GAAG,MAAM,UAAa,OAAO,UAAU,eAAe,KAAK,YAAY,SAAS,GAAG;AACvF,YAAI,GAAG,IAAI,WAAW;AAAA,MAC1B;AAEA,UAAI,IAAI,GAAG,MAAM,QAAW;AACxB,iCAAyB,YAAY,IAAI,GAAG,CAAC;AAAA,MACjD;AAAA,IACJ;AAA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AAI,YAAY;AAEZ,cAAM,gBAAgB,KAAK,2BAA2B,IAAI,QAAQ;AAClE,YAAI,eAAe;AACf,uBAAa,aAAa;AAAA,QAC9B;AAEA,cAAM,QAAQ,WAAW,SAAS,UAAU;AAC5C,aAAK,2BAA2B,IAAI,UAAU,KAAK;AAAA,MACvD,OACK;AAED,gBAAO;AAAA,MACX;AAAA,IACJ;AAEA,SAAK,uBAAuB,oBAAoB,OAAO;AAAA,EAC3D;AAAA,EACA,MAAM,uBAAuB;AACzB,WAAO,KAAK,aAAa,EAAE,QAAQ,mCAAkC,CAAE;AAAA,EAC3E;AACJ;","x_google_ignoreList":[0]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../../../../../../../../../../../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js"],"sourcesContent":["/**\n * Experimental client task features for MCP SDK.\n * WARNING: These APIs are experimental and may change without notice.\n *\n * @experimental\n */\nimport { CallToolResultSchema, McpError, ErrorCode } from '../../types.js';\n/**\n * Experimental task features for MCP clients.\n *\n * Access via `client.experimental.tasks`:\n * ```typescript\n * const stream = client.experimental.tasks.callToolStream({ name: 'tool', arguments: {} });\n * const task = await client.experimental.tasks.getTask(taskId);\n * ```\n *\n * @experimental\n */\nexport class ExperimentalClientTasks {\n constructor(_client) {\n this._client = _client;\n }\n /**\n * Calls a tool and returns an AsyncGenerator that yields response messages.\n * The generator is guaranteed to end with either a 'result' or 'error' message.\n *\n * This method provides streaming access to tool execution, allowing you to\n * observe intermediate task status updates for long-running tool calls.\n * Automatically validates structured output if the tool has an outputSchema.\n *\n * @example\n * ```typescript\n * const stream = client.experimental.tasks.callToolStream({ name: 'myTool', arguments: {} });\n * for await (const message of stream) {\n * switch (message.type) {\n * case 'taskCreated':\n * console.log('Tool execution started:', message.task.taskId);\n * break;\n * case 'taskStatus':\n * console.log('Tool status:', message.task.status);\n * break;\n * case 'result':\n * console.log('Tool result:', message.result);\n * break;\n * case 'error':\n * console.error('Tool error:', message.error);\n * break;\n * }\n * }\n * ```\n *\n * @param params - Tool call parameters (name and arguments)\n * @param resultSchema - Zod schema for validating the result (defaults to CallToolResultSchema)\n * @param options - Optional request options (timeout, signal, task creation params, etc.)\n * @returns AsyncGenerator that yields ResponseMessage objects\n *\n * @experimental\n */\n async *callToolStream(params, resultSchema = CallToolResultSchema, options) {\n // Access Client's internal methods\n const clientInternal = this._client;\n // Add task creation parameters if server supports it and not explicitly provided\n const optionsWithTask = {\n ...options,\n // We check if the tool is known to be a task during auto-configuration, but assume\n // the caller knows what they're doing if they pass this explicitly\n task: options?.task ?? (clientInternal.isToolTask(params.name) ? {} : undefined)\n };\n const stream = clientInternal.requestStream({ method: 'tools/call', params }, resultSchema, optionsWithTask);\n // Get the validator for this tool (if it has an output schema)\n const validator = clientInternal.getToolOutputValidator(params.name);\n // Iterate through the stream and validate the final result if needed\n for await (const message of stream) {\n // If this is a result message and the tool has an output schema, validate it\n if (message.type === 'result' && validator) {\n const result = message.result;\n // If tool has outputSchema, it MUST return structuredContent (unless it's an error)\n if (!result.structuredContent && !result.isError) {\n yield {\n type: 'error',\n error: new McpError(ErrorCode.InvalidRequest, `Tool ${params.name} has an output schema but did not return structured content`)\n };\n return;\n }\n // Only validate structured content if present (not when there's an error)\n if (result.structuredContent) {\n try {\n // Validate the structured content against the schema\n const validationResult = validator(result.structuredContent);\n if (!validationResult.valid) {\n yield {\n type: 'error',\n error: new McpError(ErrorCode.InvalidParams, `Structured content does not match the tool's output schema: ${validationResult.errorMessage}`)\n };\n return;\n }\n }\n catch (error) {\n if (error instanceof McpError) {\n yield { type: 'error', error };\n return;\n }\n yield {\n type: 'error',\n error: new McpError(ErrorCode.InvalidParams, `Failed to validate structured content: ${error instanceof Error ? error.message : String(error)}`)\n };\n return;\n }\n }\n }\n // Yield the message (either validated result or any other message type)\n yield message;\n }\n }\n /**\n * Gets the current status of a task.\n *\n * @param taskId - The task identifier\n * @param options - Optional request options\n * @returns The task status\n *\n * @experimental\n */\n async getTask(taskId, options) {\n return this._client.getTask({ taskId }, options);\n }\n /**\n * Retrieves the result of a completed task.\n *\n * @param taskId - The task identifier\n * @param resultSchema - Zod schema for validating the result\n * @param options - Optional request options\n * @returns The task result\n *\n * @experimental\n */\n async getTaskResult(taskId, resultSchema, options) {\n // Delegate to the client's underlying Protocol method\n return this._client.getTaskResult({ taskId }, resultSchema, options);\n }\n /**\n * Lists tasks with optional pagination.\n *\n * @param cursor - Optional pagination cursor\n * @param options - Optional request options\n * @returns List of tasks with optional next cursor\n *\n * @experimental\n */\n async listTasks(cursor, options) {\n // Delegate to the client's underlying Protocol method\n return this._client.listTasks(cursor ? { cursor } : undefined, options);\n }\n /**\n * Cancels a running task.\n *\n * @param taskId - The task identifier\n * @param options - Optional request options\n *\n * @experimental\n */\n async cancelTask(taskId, options) {\n // Delegate to the client's underlying Protocol method\n return this._client.cancelTask({ taskId }, options);\n }\n /**\n * Sends a request and returns an AsyncGenerator that yields response messages.\n * The generator is guaranteed to end with either a 'result' or 'error' message.\n *\n * This method provides streaming access to request processing, allowing you to\n * observe intermediate task status updates for task-augmented requests.\n *\n * @param request - The request to send\n * @param resultSchema - Zod schema for validating the result\n * @param options - Optional request options (timeout, signal, task creation params, etc.)\n * @returns AsyncGenerator that yields ResponseMessage objects\n *\n * @experimental\n */\n requestStream(request, resultSchema, options) {\n return this._client.requestStream(request, resultSchema, options);\n }\n}\n//# sourceMappingURL=client.js.map"],"names":[],"mappings":";;;;;;;;;AAkBO,MAAM,wBAAwB;AAAA,EACjC,YAAY,SAAS;AACjB,SAAK,UAAU;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,QAAQ,QAAQ,SAAS;AAC3B,WAAO,KAAK,QAAQ,QAAQ,EAAE,OAAM,GAAI,OAAO;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,cAAc,QAAQ,cAAc,SAAS;AAE/C,WAAO,KAAK,QAAQ,cAAc,EAAE,OAAM,GAAI,cAAc,OAAO;AAAA,EACvE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,UAAU,QAAQ,SAAS;AAE7B,WAAO,KAAK,QAAQ,UAAU,SAAS,EAAE,OAAM,IAAK,QAAW,OAAO;AAAA,EAC1E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,WAAW,QAAQ,SAAS;AAE9B,WAAO,KAAK,QAAQ,WAAW,EAAE,OAAM,GAAI,OAAO;AAAA,EACtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,cAAc,SAAS,cAAc,SAAS;AAC1C,WAAO,KAAK,QAAQ,cAAc,SAAS,cAAc,OAAO;AAAA,EACpE;AACJ;","x_google_ignoreList":[0]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../../../../../../../../../../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js"],"sourcesContent":["/**\n * Experimental task capability assertion helpers.\n * WARNING: These APIs are experimental and may change without notice.\n *\n * @experimental\n */\n/**\n * Asserts that task creation is supported for tools/call.\n * Used by Client.assertTaskCapability and Server.assertTaskHandlerCapability.\n *\n * @param requests - The task requests capability object\n * @param method - The method being checked\n * @param entityName - 'Server' or 'Client' for error messages\n * @throws Error if the capability is not supported\n *\n * @experimental\n */\nexport function assertToolsCallTaskCapability(requests, method, entityName) {\n if (!requests) {\n throw new Error(`${entityName} does not support task creation (required for ${method})`);\n }\n switch (method) {\n case 'tools/call':\n if (!requests.tools?.call) {\n throw new Error(`${entityName} does not support task creation for tools/call (required for ${method})`);\n }\n break;\n default:\n // Method doesn't support tasks, which is fine - no error\n break;\n }\n}\n/**\n * Asserts that task creation is supported for sampling/createMessage or elicitation/create.\n * Used by Server.assertTaskCapability and Client.assertTaskHandlerCapability.\n *\n * @param requests - The task requests capability object\n * @param method - The method being checked\n * @param entityName - 'Server' or 'Client' for error messages\n * @throws Error if the capability is not supported\n *\n * @experimental\n */\nexport function assertClientRequestTaskCapability(requests, method, entityName) {\n if (!requests) {\n throw new Error(`${entityName} does not support task creation (required for ${method})`);\n }\n switch (method) {\n case 'sampling/createMessage':\n if (!requests.sampling?.createMessage) {\n throw new Error(`${entityName} does not support task creation for sampling/createMessage (required for ${method})`);\n }\n break;\n case 'elicitation/create':\n if (!requests.elicitation?.create) {\n throw new Error(`${entityName} does not support task creation for elicitation/create (required for ${method})`);\n }\n break;\n default:\n // Method doesn't support tasks, which is fine - no error\n break;\n }\n}\n//# sourceMappingURL=helpers.js.map"],"names":["e"],"mappings":"AAiBO;AAAA,EAAA,WAAA;AAAA,MAAA;AAAA,QAAA,IAAA,eAAA,OAAA,SAAA,SAAA,eAAA,OAAA,SAAA,SAAA,eAAA,OAAA,aAAA,aAAA,eAAA,OAAA,OAAA,OAAA,CAAA,GAAA,IAAA,IAAA,EAAA,QAAA;AAAA,UAAA,EAAA,kBAAA,EAAA,mBAAA,CAAA,GAAA,EAAA,gBAAA,CAAA,IAAA,wCAAA,EAAA,2BAAA;AAAA,EAAA,SAAAA,IAAA;AAAA,EAAA;AAAA,GAAA;AAAA,SAAS,8BAA8B,UAAU,QAAQ,YAAY;AACxE,MAAI,CAAC,UAAU;AACX,UAAM,IAAI,MAAM,GAAG,UAAU,iDAAiD,MAAM,GAAG;AAAA,EAC3F;AACA,UAAQ,QAAM;AAAA,IACV,KAAK;AACD,UAAI,CAAC,SAAS,OAAO,MAAM;AACvB,cAAM,IAAI,MAAM,GAAG,UAAU,gEAAgE,MAAM,GAAG;AAAA,MAC1G;AACA;AAAA,EAIZ;AACA;AAYO,SAAS,kCAAkC,UAAU,QAAQ,YAAY;AAC5E,MAAI,CAAC,UAAU;AACX,UAAM,IAAI,MAAM,GAAG,UAAU,iDAAiD,MAAM,GAAG;AAAA,EAC3F;AACA,UAAQ,QAAM;AAAA,IACV,KAAK;AACD,UAAI,CAAC,SAAS,UAAU,eAAe;AACnC,cAAM,IAAI,MAAM,GAAG,UAAU,4EAA4E,MAAM,GAAG;AAAA,MACtH;AACA;AAAA,IACJ,KAAK;AACD,UAAI,CAAC,SAAS,aAAa,QAAQ;AAC/B,cAAM,IAAI,MAAM,GAAG,UAAU,wEAAwE,MAAM,GAAG;AAAA,MAClH;AACA;AAAA,EAIZ;AACA;","x_google_ignoreList":[0]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sources":["../../../../../../../../../../../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js"],"sourcesContent":["/**\n * Experimental task interfaces for MCP SDK.\n * WARNING: These APIs are experimental and may change without notice.\n */\n/**\n * Checks if a task status represents a terminal state.\n * Terminal states are those where the task has finished and will not change.\n *\n * @param status - The task status to check\n * @returns True if the status is terminal (completed, failed, or cancelled)\n * @experimental\n */\nexport function isTerminal(status) {\n return status === 'completed' || status === 'failed' || status === 'cancelled';\n}\n//# sourceMappingURL=interfaces.js.map"],"names":["e"],"mappings":"AAYO;AAAA,EAAA,WAAA;AAAA,MAAA;AAAA,QAAA,IAAA,eAAA,OAAA,SAAA,SAAA,eAAA,OAAA,SAAA,SAAA,eAAA,OAAA,aAAA,aAAA,eAAA,OAAA,OAAA,OAAA,CAAA,GAAA,IAAA,IAAA,EAAA,QAAA;AAAA,UAAA,EAAA,kBAAA,EAAA,mBAAA,CAAA,GAAA,EAAA,gBAAA,CAAA,IAAA,wCAAA,EAAA,2BAAA;AAAA,EAAA,SAAAA,IAAA;AAAA,EAAA;AAAA,GAAA;AAAA,SAAS,WAAW,QAAQ;AAC/B,SAAO,WAAW,eAAe,WAAW,YAAY,WAAW;AACvE;","x_google_ignoreList":[0]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.js","sources":["../../../../../../../../../../../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js"],"sourcesContent":["/**\n * Experimental McpServer task features for MCP SDK.\n * WARNING: These APIs are experimental and may change without notice.\n *\n * @experimental\n */\n/**\n * Experimental task features for McpServer.\n *\n * Access via `server.experimental.tasks`:\n * ```typescript\n * server.experimental.tasks.registerToolTask('long-running', config, handler);\n * ```\n *\n * @experimental\n */\nexport class ExperimentalMcpServerTasks {\n constructor(_mcpServer) {\n this._mcpServer = _mcpServer;\n }\n registerToolTask(name, config, handler) {\n // Validate that taskSupport is not 'forbidden' for task-based tools\n const execution = { taskSupport: 'required', ...config.execution };\n if (execution.taskSupport === 'forbidden') {\n throw new Error(`Cannot register task-based tool '${name}' with taskSupport 'forbidden'. Use registerTool() instead.`);\n }\n // Access McpServer's internal _createRegisteredTool method\n const mcpServerInternal = this._mcpServer;\n return mcpServerInternal._createRegisteredTool(name, config.title, config.description, config.inputSchema, config.outputSchema, config.annotations, execution, config._meta, handler);\n }\n}\n//# sourceMappingURL=mcp-server.js.map"],"names":[],"mappings":";;;;;;;;AAgBO,MAAM,2BAA2B;AAAA,EACpC,YAAY,YAAY;AACpB,SAAK,aAAa;AAAA,EACtB;AAAA,EACA,iBAAiB,MAAM,QAAQ,SAAS;AAEpC,UAAM,YAAY,EAAE,aAAa,YAAY,GAAG,OAAO,UAAS;AAChE,QAAI,UAAU,gBAAgB,aAAa;AACvC,YAAM,IAAI,MAAM,oCAAoC,IAAI,6DAA6D;AAAA,IACzH;AAEA,UAAM,oBAAoB,KAAK;AAC/B,WAAO,kBAAkB,sBAAsB,MAAM,OAAO,OAAO,OAAO,aAAa,OAAO,aAAa,OAAO,cAAc,OAAO,aAAa,WAAW,OAAO,OAAO,OAAO;AAAA,EACxL;AACJ;","x_google_ignoreList":[0]}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
;
|
|
2
|
-
!(function() {
|
|
3
|
-
try {
|
|
4
|
-
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
5
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "3fdeb029-7596-48e7-806e-8a1ad2c7fd65", e._sentryDebugIdIdentifier = "sentry-dbid-3fdeb029-7596-48e7-806e-8a1ad2c7fd65");
|
|
6
|
-
} catch (e2) {
|
|
7
|
-
}
|
|
8
|
-
})();
|
|
9
|
-
class ExperimentalServerTasks {
|
|
10
|
-
constructor(_server) {
|
|
11
|
-
this._server = _server;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Sends a request and returns an AsyncGenerator that yields response messages.
|
|
15
|
-
* The generator is guaranteed to end with either a 'result' or 'error' message.
|
|
16
|
-
*
|
|
17
|
-
* This method provides streaming access to request processing, allowing you to
|
|
18
|
-
* observe intermediate task status updates for task-augmented requests.
|
|
19
|
-
*
|
|
20
|
-
* @param request - The request to send
|
|
21
|
-
* @param resultSchema - Zod schema for validating the result
|
|
22
|
-
* @param options - Optional request options (timeout, signal, task creation params, etc.)
|
|
23
|
-
* @returns AsyncGenerator that yields ResponseMessage objects
|
|
24
|
-
*
|
|
25
|
-
* @experimental
|
|
26
|
-
*/
|
|
27
|
-
requestStream(request, resultSchema, options) {
|
|
28
|
-
return this._server.requestStream(request, resultSchema, options);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Gets the current status of a task.
|
|
32
|
-
*
|
|
33
|
-
* @param taskId - The task identifier
|
|
34
|
-
* @param options - Optional request options
|
|
35
|
-
* @returns The task status
|
|
36
|
-
*
|
|
37
|
-
* @experimental
|
|
38
|
-
*/
|
|
39
|
-
async getTask(taskId, options) {
|
|
40
|
-
return this._server.getTask({ taskId }, options);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Retrieves the result of a completed task.
|
|
44
|
-
*
|
|
45
|
-
* @param taskId - The task identifier
|
|
46
|
-
* @param resultSchema - Zod schema for validating the result
|
|
47
|
-
* @param options - Optional request options
|
|
48
|
-
* @returns The task result
|
|
49
|
-
*
|
|
50
|
-
* @experimental
|
|
51
|
-
*/
|
|
52
|
-
async getTaskResult(taskId, resultSchema, options) {
|
|
53
|
-
return this._server.getTaskResult({ taskId }, resultSchema, options);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Lists tasks with optional pagination.
|
|
57
|
-
*
|
|
58
|
-
* @param cursor - Optional pagination cursor
|
|
59
|
-
* @param options - Optional request options
|
|
60
|
-
* @returns List of tasks with optional next cursor
|
|
61
|
-
*
|
|
62
|
-
* @experimental
|
|
63
|
-
*/
|
|
64
|
-
async listTasks(cursor, options) {
|
|
65
|
-
return this._server.listTasks(cursor ? { cursor } : void 0, options);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Cancels a running task.
|
|
69
|
-
*
|
|
70
|
-
* @param taskId - The task identifier
|
|
71
|
-
* @param options - Optional request options
|
|
72
|
-
*
|
|
73
|
-
* @experimental
|
|
74
|
-
*/
|
|
75
|
-
async cancelTask(taskId, options) {
|
|
76
|
-
return this._server.cancelTask({ taskId }, options);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
export {
|
|
80
|
-
ExperimentalServerTasks
|
|
81
|
-
};
|
|
82
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sources":["../../../../../../../../../../../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js"],"sourcesContent":["/**\n * Experimental server task features for MCP SDK.\n * WARNING: These APIs are experimental and may change without notice.\n *\n * @experimental\n */\n/**\n * Experimental task features for low-level MCP servers.\n *\n * Access via `server.experimental.tasks`:\n * ```typescript\n * const stream = server.experimental.tasks.requestStream(request, schema, options);\n * ```\n *\n * For high-level server usage with task-based tools, use `McpServer.experimental.tasks` instead.\n *\n * @experimental\n */\nexport class ExperimentalServerTasks {\n constructor(_server) {\n this._server = _server;\n }\n /**\n * Sends a request and returns an AsyncGenerator that yields response messages.\n * The generator is guaranteed to end with either a 'result' or 'error' message.\n *\n * This method provides streaming access to request processing, allowing you to\n * observe intermediate task status updates for task-augmented requests.\n *\n * @param request - The request to send\n * @param resultSchema - Zod schema for validating the result\n * @param options - Optional request options (timeout, signal, task creation params, etc.)\n * @returns AsyncGenerator that yields ResponseMessage objects\n *\n * @experimental\n */\n requestStream(request, resultSchema, options) {\n return this._server.requestStream(request, resultSchema, options);\n }\n /**\n * Gets the current status of a task.\n *\n * @param taskId - The task identifier\n * @param options - Optional request options\n * @returns The task status\n *\n * @experimental\n */\n async getTask(taskId, options) {\n return this._server.getTask({ taskId }, options);\n }\n /**\n * Retrieves the result of a completed task.\n *\n * @param taskId - The task identifier\n * @param resultSchema - Zod schema for validating the result\n * @param options - Optional request options\n * @returns The task result\n *\n * @experimental\n */\n async getTaskResult(taskId, resultSchema, options) {\n return this._server.getTaskResult({ taskId }, resultSchema, options);\n }\n /**\n * Lists tasks with optional pagination.\n *\n * @param cursor - Optional pagination cursor\n * @param options - Optional request options\n * @returns List of tasks with optional next cursor\n *\n * @experimental\n */\n async listTasks(cursor, options) {\n return this._server.listTasks(cursor ? { cursor } : undefined, options);\n }\n /**\n * Cancels a running task.\n *\n * @param taskId - The task identifier\n * @param options - Optional request options\n *\n * @experimental\n */\n async cancelTask(taskId, options) {\n return this._server.cancelTask({ taskId }, options);\n }\n}\n//# sourceMappingURL=server.js.map"],"names":[],"mappings":";;;;;;;;AAkBO,MAAM,wBAAwB;AAAA,EACjC,YAAY,SAAS;AACjB,SAAK,UAAU;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,cAAc,SAAS,cAAc,SAAS;AAC1C,WAAO,KAAK,QAAQ,cAAc,SAAS,cAAc,OAAO;AAAA,EACpE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,QAAQ,QAAQ,SAAS;AAC3B,WAAO,KAAK,QAAQ,QAAQ,EAAE,OAAM,GAAI,OAAO;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,cAAc,QAAQ,cAAc,SAAS;AAC/C,WAAO,KAAK,QAAQ,cAAc,EAAE,OAAM,GAAI,cAAc,OAAO;AAAA,EACvE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,UAAU,QAAQ,SAAS;AAC7B,WAAO,KAAK,QAAQ,UAAU,SAAS,EAAE,OAAM,IAAK,QAAW,OAAO;AAAA,EAC1E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,WAAW,QAAQ,SAAS;AAC9B,WAAO,KAAK,QAAQ,WAAW,EAAE,OAAM,GAAI,OAAO;AAAA,EACtD;AACJ;","x_google_ignoreList":[0]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"completable.js","sources":["../../../../../../../../../../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js"],"sourcesContent":["export const COMPLETABLE_SYMBOL = Symbol.for('mcp.completable');\n/**\n * Wraps a Zod type to provide autocompletion capabilities. Useful for, e.g., prompt arguments in MCP.\n * Works with both Zod v3 and v4 schemas.\n */\nexport function completable(schema, complete) {\n Object.defineProperty(schema, COMPLETABLE_SYMBOL, {\n value: { complete },\n enumerable: false,\n writable: false,\n configurable: false\n });\n return schema;\n}\n/**\n * Checks if a schema is completable (has completion metadata).\n */\nexport function isCompletable(schema) {\n return !!schema && typeof schema === 'object' && COMPLETABLE_SYMBOL in schema;\n}\n/**\n * Gets the completer callback from a completable schema, if it exists.\n */\nexport function getCompleter(schema) {\n const meta = schema[COMPLETABLE_SYMBOL];\n return meta?.complete;\n}\n/**\n * Unwraps a completable schema to get the underlying schema.\n * For backward compatibility with code that called `.unwrap()`.\n */\nexport function unwrapCompletable(schema) {\n return schema;\n}\n// Legacy exports for backward compatibility\n// These types are deprecated but kept for existing code\nexport var McpZodTypeKind;\n(function (McpZodTypeKind) {\n McpZodTypeKind[\"Completable\"] = \"McpCompletable\";\n})(McpZodTypeKind || (McpZodTypeKind = {}));\n//# sourceMappingURL=completable.js.map"],"names":["e","McpZodTypeKind"],"mappings":"AAAY;AAAA,EAAA,WAAA;AAAA,MAAA;AAAA,QAAA,IAAA,eAAA,OAAA,SAAA,SAAA,eAAA,OAAA,SAAA,SAAA,eAAA,OAAA,aAAA,aAAA,eAAA,OAAA,OAAA,OAAA,CAAA,GAAA,IAAA,IAAA,EAAA,QAAA;AAAA,UAAA,EAAA,kBAAA,EAAA,mBAAA,CAAA,GAAA,EAAA,gBAAA,CAAA,IAAA,wCAAA,EAAA,2BAAA;AAAA,EAAA,SAAAA,IAAA;AAAA,EAAA;AAAA,GAAA;AAAA,MAAC,qBAAqB,OAAO,IAAI,iBAAiB;AAiBvD,SAAS,cAAc,QAAQ;AAClC,SAAO,CAAC,CAAC,UAAU,OAAO,WAAW,YAAY,sBAAsB;AAC3E;AAIO,SAAS,aAAa,QAAQ;AACjC,QAAM,OAAO,OAAO,kBAAkB;AACtC,SAAO,MAAM;AACjB;AAUU,IAAC;AAAA,CACV,SAAUC,iBAAgB;AACvB,EAAAA,gBAAe,aAAa,IAAI;AACpC,GAAG,mBAAmB,iBAAiB,CAAA,EAAG;","x_google_ignoreList":[0]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../../../../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js"],"sourcesContent":["import { mergeCapabilities, Protocol } from '../shared/protocol.js';\nimport { CreateMessageResultSchema, CreateMessageResultWithToolsSchema, ElicitResultSchema, EmptyResultSchema, ErrorCode, InitializedNotificationSchema, InitializeRequestSchema, LATEST_PROTOCOL_VERSION, ListRootsResultSchema, LoggingLevelSchema, McpError, SetLevelRequestSchema, SUPPORTED_PROTOCOL_VERSIONS, CallToolRequestSchema, CallToolResultSchema, CreateTaskResultSchema } from '../types.js';\nimport { AjvJsonSchemaValidator } from '../validation/ajv-provider.js';\nimport { getObjectShape, isZ4Schema, safeParse } from './zod-compat.js';\nimport { ExperimentalServerTasks } from '../experimental/tasks/server.js';\nimport { assertToolsCallTaskCapability, assertClientRequestTaskCapability } from '../experimental/tasks/helpers.js';\n/**\n * An MCP server on top of a pluggable transport.\n *\n * This server will automatically respond to the initialization flow as initiated from the client.\n *\n * To use with custom types, extend the base Request/Notification/Result types and pass them as type parameters:\n *\n * ```typescript\n * // Custom schemas\n * const CustomRequestSchema = RequestSchema.extend({...})\n * const CustomNotificationSchema = NotificationSchema.extend({...})\n * const CustomResultSchema = ResultSchema.extend({...})\n *\n * // Type aliases\n * type CustomRequest = z.infer<typeof CustomRequestSchema>\n * type CustomNotification = z.infer<typeof CustomNotificationSchema>\n * type CustomResult = z.infer<typeof CustomResultSchema>\n *\n * // Create typed server\n * const server = new Server<CustomRequest, CustomNotification, CustomResult>({\n * name: \"CustomServer\",\n * version: \"1.0.0\"\n * })\n * ```\n * @deprecated Use `McpServer` instead for the high-level API. Only use `Server` for advanced use cases.\n */\nexport class Server extends Protocol {\n /**\n * Initializes this server with the given name and version information.\n */\n constructor(_serverInfo, options) {\n super(options);\n this._serverInfo = _serverInfo;\n // Map log levels by session id\n this._loggingLevels = new Map();\n // Map LogLevelSchema to severity index\n this.LOG_LEVEL_SEVERITY = new Map(LoggingLevelSchema.options.map((level, index) => [level, index]));\n // Is a message with the given level ignored in the log level set for the given session id?\n this.isMessageIgnored = (level, sessionId) => {\n const currentLevel = this._loggingLevels.get(sessionId);\n return currentLevel ? this.LOG_LEVEL_SEVERITY.get(level) < this.LOG_LEVEL_SEVERITY.get(currentLevel) : false;\n };\n this._capabilities = options?.capabilities ?? {};\n this._instructions = options?.instructions;\n this._jsonSchemaValidator = options?.jsonSchemaValidator ?? new AjvJsonSchemaValidator();\n this.setRequestHandler(InitializeRequestSchema, request => this._oninitialize(request));\n this.setNotificationHandler(InitializedNotificationSchema, () => this.oninitialized?.());\n if (this._capabilities.logging) {\n this.setRequestHandler(SetLevelRequestSchema, async (request, extra) => {\n const transportSessionId = extra.sessionId || extra.requestInfo?.headers['mcp-session-id'] || undefined;\n const { level } = request.params;\n const parseResult = LoggingLevelSchema.safeParse(level);\n if (parseResult.success) {\n this._loggingLevels.set(transportSessionId, parseResult.data);\n }\n return {};\n });\n }\n }\n /**\n * Access experimental features.\n *\n * WARNING: These APIs are experimental and may change without notice.\n *\n * @experimental\n */\n get experimental() {\n if (!this._experimental) {\n this._experimental = {\n tasks: new ExperimentalServerTasks(this)\n };\n }\n return this._experimental;\n }\n /**\n * Registers new capabilities. This can only be called before connecting to a transport.\n *\n * The new capabilities will be merged with any existing capabilities previously given (e.g., at initialization).\n */\n registerCapabilities(capabilities) {\n if (this.transport) {\n throw new Error('Cannot register capabilities after connecting to transport');\n }\n this._capabilities = mergeCapabilities(this._capabilities, capabilities);\n }\n /**\n * Override request handler registration to enforce server-side validation for tools/call.\n */\n setRequestHandler(requestSchema, handler) {\n const shape = getObjectShape(requestSchema);\n const methodSchema = shape?.method;\n if (!methodSchema) {\n throw new Error('Schema is missing a method literal');\n }\n // Extract literal value using type-safe property access\n let methodValue;\n if (isZ4Schema(methodSchema)) {\n const v4Schema = methodSchema;\n const v4Def = v4Schema._zod?.def;\n methodValue = v4Def?.value ?? v4Schema.value;\n }\n else {\n const v3Schema = methodSchema;\n const legacyDef = v3Schema._def;\n methodValue = legacyDef?.value ?? v3Schema.value;\n }\n if (typeof methodValue !== 'string') {\n throw new Error('Schema method literal must be a string');\n }\n const method = methodValue;\n if (method === 'tools/call') {\n const wrappedHandler = async (request, extra) => {\n const validatedRequest = safeParse(CallToolRequestSchema, request);\n if (!validatedRequest.success) {\n const errorMessage = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error);\n throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${errorMessage}`);\n }\n const { params } = validatedRequest.data;\n const result = await Promise.resolve(handler(request, extra));\n // When task creation is requested, validate and return CreateTaskResult\n if (params.task) {\n const taskValidationResult = safeParse(CreateTaskResultSchema, result);\n if (!taskValidationResult.success) {\n const errorMessage = taskValidationResult.error instanceof Error\n ? taskValidationResult.error.message\n : String(taskValidationResult.error);\n throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage}`);\n }\n return taskValidationResult.data;\n }\n // For non-task requests, validate against CallToolResultSchema\n const validationResult = safeParse(CallToolResultSchema, result);\n if (!validationResult.success) {\n const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);\n throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${errorMessage}`);\n }\n return validationResult.data;\n };\n // Install the wrapped handler\n return super.setRequestHandler(requestSchema, wrappedHandler);\n }\n // Other handlers use default behavior\n return super.setRequestHandler(requestSchema, handler);\n }\n assertCapabilityForMethod(method) {\n switch (method) {\n case 'sampling/createMessage':\n if (!this._clientCapabilities?.sampling) {\n throw new Error(`Client does not support sampling (required for ${method})`);\n }\n break;\n case 'elicitation/create':\n if (!this._clientCapabilities?.elicitation) {\n throw new Error(`Client does not support elicitation (required for ${method})`);\n }\n break;\n case 'roots/list':\n if (!this._clientCapabilities?.roots) {\n throw new Error(`Client does not support listing roots (required for ${method})`);\n }\n break;\n case 'ping':\n // No specific capability required for ping\n break;\n }\n }\n assertNotificationCapability(method) {\n switch (method) {\n case 'notifications/message':\n if (!this._capabilities.logging) {\n throw new Error(`Server does not support logging (required for ${method})`);\n }\n break;\n case 'notifications/resources/updated':\n case 'notifications/resources/list_changed':\n if (!this._capabilities.resources) {\n throw new Error(`Server does not support notifying about resources (required for ${method})`);\n }\n break;\n case 'notifications/tools/list_changed':\n if (!this._capabilities.tools) {\n throw new Error(`Server does not support notifying of tool list changes (required for ${method})`);\n }\n break;\n case 'notifications/prompts/list_changed':\n if (!this._capabilities.prompts) {\n throw new Error(`Server does not support notifying of prompt list changes (required for ${method})`);\n }\n break;\n case 'notifications/elicitation/complete':\n if (!this._clientCapabilities?.elicitation?.url) {\n throw new Error(`Client does not support URL elicitation (required for ${method})`);\n }\n break;\n case 'notifications/cancelled':\n // Cancellation notifications are always allowed\n break;\n case 'notifications/progress':\n // Progress notifications are always allowed\n break;\n }\n }\n assertRequestHandlerCapability(method) {\n // Task handlers are registered in Protocol constructor before _capabilities is initialized\n // Skip capability check for task methods during initialization\n if (!this._capabilities) {\n return;\n }\n switch (method) {\n case 'completion/complete':\n if (!this._capabilities.completions) {\n throw new Error(`Server does not support completions (required for ${method})`);\n }\n break;\n case 'logging/setLevel':\n if (!this._capabilities.logging) {\n throw new Error(`Server does not support logging (required for ${method})`);\n }\n break;\n case 'prompts/get':\n case 'prompts/list':\n if (!this._capabilities.prompts) {\n throw new Error(`Server does not support prompts (required for ${method})`);\n }\n break;\n case 'resources/list':\n case 'resources/templates/list':\n case 'resources/read':\n if (!this._capabilities.resources) {\n throw new Error(`Server does not support resources (required for ${method})`);\n }\n break;\n case 'tools/call':\n case 'tools/list':\n if (!this._capabilities.tools) {\n throw new Error(`Server does not support tools (required for ${method})`);\n }\n break;\n case 'tasks/get':\n case 'tasks/list':\n case 'tasks/result':\n case 'tasks/cancel':\n if (!this._capabilities.tasks) {\n throw new Error(`Server does not support tasks capability (required for ${method})`);\n }\n break;\n case 'ping':\n case 'initialize':\n // No specific capability required for these methods\n break;\n }\n }\n assertTaskCapability(method) {\n assertClientRequestTaskCapability(this._clientCapabilities?.tasks?.requests, method, 'Client');\n }\n assertTaskHandlerCapability(method) {\n // Task handlers are registered in Protocol constructor before _capabilities is initialized\n // Skip capability check for task methods during initialization\n if (!this._capabilities) {\n return;\n }\n assertToolsCallTaskCapability(this._capabilities.tasks?.requests, method, 'Server');\n }\n async _oninitialize(request) {\n const requestedVersion = request.params.protocolVersion;\n this._clientCapabilities = request.params.capabilities;\n this._clientVersion = request.params.clientInfo;\n const protocolVersion = SUPPORTED_PROTOCOL_VERSIONS.includes(requestedVersion) ? requestedVersion : LATEST_PROTOCOL_VERSION;\n return {\n protocolVersion,\n capabilities: this.getCapabilities(),\n serverInfo: this._serverInfo,\n ...(this._instructions && { instructions: this._instructions })\n };\n }\n /**\n * After initialization has completed, this will be populated with the client's reported capabilities.\n */\n getClientCapabilities() {\n return this._clientCapabilities;\n }\n /**\n * After initialization has completed, this will be populated with information about the client's name and version.\n */\n getClientVersion() {\n return this._clientVersion;\n }\n getCapabilities() {\n return this._capabilities;\n }\n async ping() {\n return this.request({ method: 'ping' }, EmptyResultSchema);\n }\n // Implementation\n async createMessage(params, options) {\n // Capability check - only required when tools/toolChoice are provided\n if (params.tools || params.toolChoice) {\n if (!this._clientCapabilities?.sampling?.tools) {\n throw new Error('Client does not support sampling tools capability.');\n }\n }\n // Message structure validation - always validate tool_use/tool_result pairs.\n // These may appear even without tools/toolChoice in the current request when\n // a previous sampling request returned tool_use and this is a follow-up with results.\n if (params.messages.length > 0) {\n const lastMessage = params.messages[params.messages.length - 1];\n const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];\n const hasToolResults = lastContent.some(c => c.type === 'tool_result');\n const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;\n const previousContent = previousMessage\n ? Array.isArray(previousMessage.content)\n ? previousMessage.content\n : [previousMessage.content]\n : [];\n const hasPreviousToolUse = previousContent.some(c => c.type === 'tool_use');\n if (hasToolResults) {\n if (lastContent.some(c => c.type !== 'tool_result')) {\n throw new Error('The last message must contain only tool_result content if any is present');\n }\n if (!hasPreviousToolUse) {\n throw new Error('tool_result blocks are not matching any tool_use from the previous message');\n }\n }\n if (hasPreviousToolUse) {\n const toolUseIds = new Set(previousContent.filter(c => c.type === 'tool_use').map(c => c.id));\n const toolResultIds = new Set(lastContent.filter(c => c.type === 'tool_result').map(c => c.toolUseId));\n if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every(id => toolResultIds.has(id))) {\n throw new Error('ids of tool_result blocks and tool_use blocks from previous message do not match');\n }\n }\n }\n // Use different schemas based on whether tools are provided\n if (params.tools) {\n return this.request({ method: 'sampling/createMessage', params }, CreateMessageResultWithToolsSchema, options);\n }\n return this.request({ method: 'sampling/createMessage', params }, CreateMessageResultSchema, options);\n }\n /**\n * Creates an elicitation request for the given parameters.\n * For backwards compatibility, `mode` may be omitted for form requests and will default to `'form'`.\n * @param params The parameters for the elicitation request.\n * @param options Optional request options.\n * @returns The result of the elicitation request.\n */\n async elicitInput(params, options) {\n const mode = (params.mode ?? 'form');\n switch (mode) {\n case 'url': {\n if (!this._clientCapabilities?.elicitation?.url) {\n throw new Error('Client does not support url elicitation.');\n }\n const urlParams = params;\n return this.request({ method: 'elicitation/create', params: urlParams }, ElicitResultSchema, options);\n }\n case 'form': {\n if (!this._clientCapabilities?.elicitation?.form) {\n throw new Error('Client does not support form elicitation.');\n }\n const formParams = params.mode === 'form' ? params : { ...params, mode: 'form' };\n const result = await this.request({ method: 'elicitation/create', params: formParams }, ElicitResultSchema, options);\n if (result.action === 'accept' && result.content && formParams.requestedSchema) {\n try {\n const validator = this._jsonSchemaValidator.getValidator(formParams.requestedSchema);\n const validationResult = validator(result.content);\n if (!validationResult.valid) {\n throw new McpError(ErrorCode.InvalidParams, `Elicitation response content does not match requested schema: ${validationResult.errorMessage}`);\n }\n }\n catch (error) {\n if (error instanceof McpError) {\n throw error;\n }\n throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n return result;\n }\n }\n }\n /**\n * Creates a reusable callback that, when invoked, will send a `notifications/elicitation/complete`\n * notification for the specified elicitation ID.\n *\n * @param elicitationId The ID of the elicitation to mark as complete.\n * @param options Optional notification options. Useful when the completion notification should be related to a prior request.\n * @returns A function that emits the completion notification when awaited.\n */\n createElicitationCompletionNotifier(elicitationId, options) {\n if (!this._clientCapabilities?.elicitation?.url) {\n throw new Error('Client does not support URL elicitation (required for notifications/elicitation/complete)');\n }\n return () => this.notification({\n method: 'notifications/elicitation/complete',\n params: {\n elicitationId\n }\n }, options);\n }\n async listRoots(params, options) {\n return this.request({ method: 'roots/list', params }, ListRootsResultSchema, options);\n }\n /**\n * Sends a logging message to the client, if connected.\n * Note: You only need to send the parameters object, not the entire JSON RPC message\n * @see LoggingMessageNotification\n * @param params\n * @param sessionId optional for stateless and backward compatibility\n */\n async sendLoggingMessage(params, sessionId) {\n if (this._capabilities.logging) {\n if (!this.isMessageIgnored(params.level, sessionId)) {\n return this.notification({ method: 'notifications/message', params });\n }\n }\n }\n async sendResourceUpdated(params) {\n return this.notification({\n method: 'notifications/resources/updated',\n params\n });\n }\n async sendResourceListChanged() {\n return this.notification({\n method: 'notifications/resources/list_changed'\n });\n }\n async sendToolListChanged() {\n return this.notification({ method: 'notifications/tools/list_changed' });\n }\n async sendPromptListChanged() {\n return this.notification({ method: 'notifications/prompts/list_changed' });\n }\n}\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;;;;;;;;;;AAgCO,MAAM,eAAe,SAAS;AAAA;AAAA;AAAA;AAAA,EAIjC,YAAY,aAAa,SAAS;AAC9B,UAAM,OAAO;AACb,SAAK,cAAc;AAEnB,SAAK,iBAAiB,oBAAI,IAAG;AAE7B,SAAK,qBAAqB,IAAI,IAAI,mBAAmB,QAAQ,IAAI,CAAC,OAAO,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AAElG,SAAK,mBAAmB,CAAC,OAAO,cAAc;AAC1C,YAAM,eAAe,KAAK,eAAe,IAAI,SAAS;AACtD,aAAO,eAAe,KAAK,mBAAmB,IAAI,KAAK,IAAI,KAAK,mBAAmB,IAAI,YAAY,IAAI;AAAA,IAC3G;AACA,SAAK,gBAAgB,SAAS,gBAAgB,CAAA;AAC9C,SAAK,gBAAgB,SAAS;AAC9B,SAAK,uBAAuB,SAAS,uBAAuB,IAAI,uBAAsB;AACtF,SAAK,kBAAkB,yBAAyB,aAAW,KAAK,cAAc,OAAO,CAAC;AACtF,SAAK,uBAAuB,+BAA+B,MAAM,KAAK,gBAAa,CAAI;AACvF,QAAI,KAAK,cAAc,SAAS;AAC5B,WAAK,kBAAkB,uBAAuB,OAAO,SAAS,UAAU;AACpE,cAAM,qBAAqB,MAAM,aAAa,MAAM,aAAa,QAAQ,gBAAgB,KAAK;AAC9F,cAAM,EAAE,UAAU,QAAQ;AAC1B,cAAM,cAAc,mBAAmB,UAAU,KAAK;AACtD,YAAI,YAAY,SAAS;AACrB,eAAK,eAAe,IAAI,oBAAoB,YAAY,IAAI;AAAA,QAChE;AACA,eAAO,CAAA;AAAA,MACX,CAAC;AAAA,IACL;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAI,eAAe;AACf,QAAI,CAAC,KAAK,eAAe;AACrB,WAAK,gBAAgB;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A,oCAAoC,eAAe,SAAS;AACxD,QAAI,CAAC,KAAK,qBAAqB,aAAa,KAAK;AAC7C,YAAM,IAAI,MAAM,2FAA2F;AAAA,IAC/G;AACA,WAAO,MAAM,KAAK,aAAa;AAAA,MAC3B,QAAQ;AAAA,MACR,QAAQ;AAAA,QACJ;AAAA,MAChB;AAAA,IACA,GAAW,OAAO;AAAA,EACd;AAAA,EACA,MAAM,UAAU,QAAQ,SAAS;AAC7B,WAAO,KAAK,QAAQ,EAAE,QAAQ,cAAc,OAAM,GAAI,uBAAuB,OAAO;AAAA,EACxF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,mBAAmB,QAAQ,WAAW;AACxC,QAAI,KAAK,cAAc,SAAS;AAC5B,UAAI,CAAC,KAAK,iBAAiB,OAAO,OAAO,SAAS,GAAG;AACjD,eAAO,KAAK,aAAa,EAAE,QAAQ,yBAAyB,OAAM,CAAE;AAAA,MACxE;AAAA,IACJ;AAAA,EACJ;AAAA,EACA,MAAM,oBAAoB,QAAQ;AAC9B,WAAO,KAAK,aAAa;AAAA,MACrB,QAAQ;AAAA,MACR;AAAA,IACZ,CAAS;AAAA,EACL;AAAA,EACA,MAAM,0BAA0B;AAC5B,WAAO,KAAK,aAAa;AAAA,MACrB,QAAQ;AAAA,IACpB,CAAS;AAAA,EACL;AAAA,EACA,MAAM,sBAAsB;AACxB,WAAO,KAAK,aAAa,EAAE,QAAQ,mCAAkC,CAAE;AAAA,EAC3E;AAAA,EACA,MAAM,wBAAwB;AAC1B,WAAO,KAAK,aAAa,EAAE,QAAQ,qCAAoC,CAAE;AAAA,EAC7E;AACJ;","x_google_ignoreList":[0]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.js","sources":["../../../../../../../../../../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js"],"sourcesContent":["import { Server } from './index.js';\nimport { normalizeObjectSchema, safeParseAsync, getObjectShape, objectFromShape, getParseErrorMessage, getSchemaDescription, isSchemaOptional, getLiteralValue } from './zod-compat.js';\nimport { toJsonSchemaCompat } from './zod-json-schema-compat.js';\nimport { McpError, ErrorCode, ListResourceTemplatesRequestSchema, ReadResourceRequestSchema, ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, CompleteRequestSchema, assertCompleteRequestPrompt, assertCompleteRequestResourceTemplate } from '../types.js';\nimport { isCompletable, getCompleter } from './completable.js';\nimport { UriTemplate } from '../shared/uriTemplate.js';\nimport { validateAndWarnToolName } from '../shared/toolNameValidation.js';\nimport { ExperimentalMcpServerTasks } from '../experimental/tasks/mcp-server.js';\nimport { ZodOptional } from 'zod';\n/**\n * High-level MCP server that provides a simpler API for working with resources, tools, and prompts.\n * For advanced usage (like sending notifications or setting custom request handlers), use the underlying\n * Server instance available via the `server` property.\n */\nexport class McpServer {\n constructor(serverInfo, options) {\n this._registeredResources = {};\n this._registeredResourceTemplates = {};\n this._registeredTools = {};\n this._registeredPrompts = {};\n this._toolHandlersInitialized = false;\n this._completionHandlerInitialized = false;\n this._resourceHandlersInitialized = false;\n this._promptHandlersInitialized = false;\n this.server = new Server(serverInfo, options);\n }\n /**\n * Access experimental features.\n *\n * WARNING: These APIs are experimental and may change without notice.\n *\n * @experimental\n */\n get experimental() {\n if (!this._experimental) {\n this._experimental = {\n tasks: new ExperimentalMcpServerTasks(this)\n };\n }\n return this._experimental;\n }\n /**\n * Attaches to the given transport, starts it, and starts listening for messages.\n *\n * The `server` object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.\n */\n async connect(transport) {\n return await this.server.connect(transport);\n }\n /**\n * Closes the connection.\n */\n async close() {\n await this.server.close();\n }\n setToolRequestHandlers() {\n if (this._toolHandlersInitialized) {\n return;\n }\n this.server.assertCanSetRequestHandler(getMethodValue(ListToolsRequestSchema));\n this.server.assertCanSetRequestHandler(getMethodValue(CallToolRequestSchema));\n this.server.registerCapabilities({\n tools: {\n listChanged: true\n }\n });\n this.server.setRequestHandler(ListToolsRequestSchema, () => ({\n tools: Object.entries(this._registeredTools)\n .filter(([, tool]) => tool.enabled)\n .map(([name, tool]) => {\n const toolDefinition = {\n name,\n title: tool.title,\n description: tool.description,\n inputSchema: (() => {\n const obj = normalizeObjectSchema(tool.inputSchema);\n return obj\n ? toJsonSchemaCompat(obj, {\n strictUnions: true,\n pipeStrategy: 'input'\n })\n : EMPTY_OBJECT_JSON_SCHEMA;\n })(),\n annotations: tool.annotations,\n execution: tool.execution,\n _meta: tool._meta\n };\n if (tool.outputSchema) {\n const obj = normalizeObjectSchema(tool.outputSchema);\n if (obj) {\n toolDefinition.outputSchema = toJsonSchemaCompat(obj, {\n strictUnions: true,\n pipeStrategy: 'output'\n });\n }\n }\n return toolDefinition;\n })\n }));\n this.server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {\n try {\n const tool = this._registeredTools[request.params.name];\n if (!tool) {\n throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} not found`);\n }\n if (!tool.enabled) {\n throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} disabled`);\n }\n const isTaskRequest = !!request.params.task;\n const taskSupport = tool.execution?.taskSupport;\n const isTaskHandler = 'createTask' in tool.handler;\n // Validate task hint configuration\n if ((taskSupport === 'required' || taskSupport === 'optional') && !isTaskHandler) {\n throw new McpError(ErrorCode.InternalError, `Tool ${request.params.name} has taskSupport '${taskSupport}' but was not registered with registerToolTask`);\n }\n // Handle taskSupport 'required' without task augmentation\n if (taskSupport === 'required' && !isTaskRequest) {\n throw new McpError(ErrorCode.MethodNotFound, `Tool ${request.params.name} requires task augmentation (taskSupport: 'required')`);\n }\n // Handle taskSupport 'optional' without task augmentation - automatic polling\n if (taskSupport === 'optional' && !isTaskRequest && isTaskHandler) {\n return await this.handleAutomaticTaskPolling(tool, request, extra);\n }\n // Normal execution path\n const args = await this.validateToolInput(tool, request.params.arguments, request.params.name);\n const result = await this.executeToolHandler(tool, args, extra);\n // Return CreateTaskResult immediately for task requests\n if (isTaskRequest) {\n return result;\n }\n // Validate output schema for non-task requests\n await this.validateToolOutput(tool, result, request.params.name);\n return result;\n }\n catch (error) {\n if (error instanceof McpError) {\n if (error.code === ErrorCode.UrlElicitationRequired) {\n throw error; // Return the error to the caller without wrapping in CallToolResult\n }\n }\n return this.createToolError(error instanceof Error ? error.message : String(error));\n }\n });\n this._toolHandlersInitialized = true;\n }\n /**\n * Creates a tool error result.\n *\n * @param errorMessage - The error message.\n * @returns The tool error result.\n */\n createToolError(errorMessage) {\n return {\n content: [\n {\n type: 'text',\n text: errorMessage\n }\n ],\n isError: true\n };\n }\n /**\n * Validates tool input arguments against the tool's input schema.\n */\n async validateToolInput(tool, args, toolName) {\n if (!tool.inputSchema) {\n return undefined;\n }\n // Try to normalize to object schema first (for raw shapes and object schemas)\n // If that fails, use the schema directly (for union/intersection/etc)\n const inputObj = normalizeObjectSchema(tool.inputSchema);\n const schemaToParse = inputObj ?? tool.inputSchema;\n const parseResult = await safeParseAsync(schemaToParse, args);\n if (!parseResult.success) {\n const error = 'error' in parseResult ? parseResult.error : 'Unknown error';\n const errorMessage = getParseErrorMessage(error);\n throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${errorMessage}`);\n }\n return parseResult.data;\n }\n /**\n * Validates tool output against the tool's output schema.\n */\n async validateToolOutput(tool, result, toolName) {\n if (!tool.outputSchema) {\n return;\n }\n // Only validate CallToolResult, not CreateTaskResult\n if (!('content' in result)) {\n return;\n }\n if (result.isError) {\n return;\n }\n if (!result.structuredContent) {\n throw new McpError(ErrorCode.InvalidParams, `Output validation error: Tool ${toolName} has an output schema but no structured content was provided`);\n }\n // if the tool has an output schema, validate structured content\n const outputObj = normalizeObjectSchema(tool.outputSchema);\n const parseResult = await safeParseAsync(outputObj, result.structuredContent);\n if (!parseResult.success) {\n const error = 'error' in parseResult ? parseResult.error : 'Unknown error';\n const errorMessage = getParseErrorMessage(error);\n throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${errorMessage}`);\n }\n }\n /**\n * Executes a tool handler (either regular or task-based).\n */\n async executeToolHandler(tool, args, extra) {\n const handler = tool.handler;\n const isTaskHandler = 'createTask' in handler;\n if (isTaskHandler) {\n if (!extra.taskStore) {\n throw new Error('No task store provided.');\n }\n const taskExtra = { ...extra, taskStore: extra.taskStore };\n if (tool.inputSchema) {\n const typedHandler = handler;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return await Promise.resolve(typedHandler.createTask(args, taskExtra));\n }\n else {\n const typedHandler = handler;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return await Promise.resolve(typedHandler.createTask(taskExtra));\n }\n }\n if (tool.inputSchema) {\n const typedHandler = handler;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return await Promise.resolve(typedHandler(args, extra));\n }\n else {\n const typedHandler = handler;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return await Promise.resolve(typedHandler(extra));\n }\n }\n /**\n * Handles automatic task polling for tools with taskSupport 'optional'.\n */\n async handleAutomaticTaskPolling(tool, request, extra) {\n if (!extra.taskStore) {\n throw new Error('No task store provided for task-capable tool.');\n }\n // Validate input and create task\n const args = await this.validateToolInput(tool, request.params.arguments, request.params.name);\n const handler = tool.handler;\n const taskExtra = { ...extra, taskStore: extra.taskStore };\n const createTaskResult = args // undefined only if tool.inputSchema is undefined\n ? await Promise.resolve(handler.createTask(args, taskExtra))\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n await Promise.resolve(handler.createTask(taskExtra));\n // Poll until completion\n const taskId = createTaskResult.task.taskId;\n let task = createTaskResult.task;\n const pollInterval = task.pollInterval ?? 5000;\n while (task.status !== 'completed' && task.status !== 'failed' && task.status !== 'cancelled') {\n await new Promise(resolve => setTimeout(resolve, pollInterval));\n const updatedTask = await extra.taskStore.getTask(taskId);\n if (!updatedTask) {\n throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);\n }\n task = updatedTask;\n }\n // Return the final result\n return (await extra.taskStore.getTaskResult(taskId));\n }\n setCompletionRequestHandler() {\n if (this._completionHandlerInitialized) {\n return;\n }\n this.server.assertCanSetRequestHandler(getMethodValue(CompleteRequestSchema));\n this.server.registerCapabilities({\n completions: {}\n });\n this.server.setRequestHandler(CompleteRequestSchema, async (request) => {\n switch (request.params.ref.type) {\n case 'ref/prompt':\n assertCompleteRequestPrompt(request);\n return this.handlePromptCompletion(request, request.params.ref);\n case 'ref/resource':\n assertCompleteRequestResourceTemplate(request);\n return this.handleResourceCompletion(request, request.params.ref);\n default:\n throw new McpError(ErrorCode.InvalidParams, `Invalid completion reference: ${request.params.ref}`);\n }\n });\n this._completionHandlerInitialized = true;\n }\n async handlePromptCompletion(request, ref) {\n const prompt = this._registeredPrompts[ref.name];\n if (!prompt) {\n throw new McpError(ErrorCode.InvalidParams, `Prompt ${ref.name} not found`);\n }\n if (!prompt.enabled) {\n throw new McpError(ErrorCode.InvalidParams, `Prompt ${ref.name} disabled`);\n }\n if (!prompt.argsSchema) {\n return EMPTY_COMPLETION_RESULT;\n }\n const promptShape = getObjectShape(prompt.argsSchema);\n const field = promptShape?.[request.params.argument.name];\n if (!isCompletable(field)) {\n return EMPTY_COMPLETION_RESULT;\n }\n const completer = getCompleter(field);\n if (!completer) {\n return EMPTY_COMPLETION_RESULT;\n }\n const suggestions = await completer(request.params.argument.value, request.params.context);\n return createCompletionResult(suggestions);\n }\n async handleResourceCompletion(request, ref) {\n const template = Object.values(this._registeredResourceTemplates).find(t => t.resourceTemplate.uriTemplate.toString() === ref.uri);\n if (!template) {\n if (this._registeredResources[ref.uri]) {\n // Attempting to autocomplete a fixed resource URI is not an error in the spec (but probably should be).\n return EMPTY_COMPLETION_RESULT;\n }\n throw new McpError(ErrorCode.InvalidParams, `Resource template ${request.params.ref.uri} not found`);\n }\n const completer = template.resourceTemplate.completeCallback(request.params.argument.name);\n if (!completer) {\n return EMPTY_COMPLETION_RESULT;\n }\n const suggestions = await completer(request.params.argument.value, request.params.context);\n return createCompletionResult(suggestions);\n }\n setResourceRequestHandlers() {\n if (this._resourceHandlersInitialized) {\n return;\n }\n this.server.assertCanSetRequestHandler(getMethodValue(ListResourcesRequestSchema));\n this.server.assertCanSetRequestHandler(getMethodValue(ListResourceTemplatesRequestSchema));\n this.server.assertCanSetRequestHandler(getMethodValue(ReadResourceRequestSchema));\n this.server.registerCapabilities({\n resources: {\n listChanged: true\n }\n });\n this.server.setRequestHandler(ListResourcesRequestSchema, async (request, extra) => {\n const resources = Object.entries(this._registeredResources)\n .filter(([_, resource]) => resource.enabled)\n .map(([uri, resource]) => ({\n uri,\n name: resource.name,\n ...resource.metadata\n }));\n const templateResources = [];\n for (const template of Object.values(this._registeredResourceTemplates)) {\n if (!template.resourceTemplate.listCallback) {\n continue;\n }\n const result = await template.resourceTemplate.listCallback(extra);\n for (const resource of result.resources) {\n templateResources.push({\n ...template.metadata,\n // the defined resource metadata should override the template metadata if present\n ...resource\n });\n }\n }\n return { resources: [...resources, ...templateResources] };\n });\n this.server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => {\n const resourceTemplates = Object.entries(this._registeredResourceTemplates).map(([name, template]) => ({\n name,\n uriTemplate: template.resourceTemplate.uriTemplate.toString(),\n ...template.metadata\n }));\n return { resourceTemplates };\n });\n this.server.setRequestHandler(ReadResourceRequestSchema, async (request, extra) => {\n const uri = new URL(request.params.uri);\n // First check for exact resource match\n const resource = this._registeredResources[uri.toString()];\n if (resource) {\n if (!resource.enabled) {\n throw new McpError(ErrorCode.InvalidParams, `Resource ${uri} disabled`);\n }\n return resource.readCallback(uri, extra);\n }\n // Then check templates\n for (const template of Object.values(this._registeredResourceTemplates)) {\n const variables = template.resourceTemplate.uriTemplate.match(uri.toString());\n if (variables) {\n return template.readCallback(uri, variables, extra);\n }\n }\n throw new McpError(ErrorCode.InvalidParams, `Resource ${uri} not found`);\n });\n this._resourceHandlersInitialized = true;\n }\n setPromptRequestHandlers() {\n if (this._promptHandlersInitialized) {\n return;\n }\n this.server.assertCanSetRequestHandler(getMethodValue(ListPromptsRequestSchema));\n this.server.assertCanSetRequestHandler(getMethodValue(GetPromptRequestSchema));\n this.server.registerCapabilities({\n prompts: {\n listChanged: true\n }\n });\n this.server.setRequestHandler(ListPromptsRequestSchema, () => ({\n prompts: Object.entries(this._registeredPrompts)\n .filter(([, prompt]) => prompt.enabled)\n .map(([name, prompt]) => {\n return {\n name,\n title: prompt.title,\n description: prompt.description,\n arguments: prompt.argsSchema ? promptArgumentsFromSchema(prompt.argsSchema) : undefined\n };\n })\n }));\n this.server.setRequestHandler(GetPromptRequestSchema, async (request, extra) => {\n const prompt = this._registeredPrompts[request.params.name];\n if (!prompt) {\n throw new McpError(ErrorCode.InvalidParams, `Prompt ${request.params.name} not found`);\n }\n if (!prompt.enabled) {\n throw new McpError(ErrorCode.InvalidParams, `Prompt ${request.params.name} disabled`);\n }\n if (prompt.argsSchema) {\n const argsObj = normalizeObjectSchema(prompt.argsSchema);\n const parseResult = await safeParseAsync(argsObj, request.params.arguments);\n if (!parseResult.success) {\n const error = 'error' in parseResult ? parseResult.error : 'Unknown error';\n const errorMessage = getParseErrorMessage(error);\n throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${errorMessage}`);\n }\n const args = parseResult.data;\n const cb = prompt.callback;\n return await Promise.resolve(cb(args, extra));\n }\n else {\n const cb = prompt.callback;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return await Promise.resolve(cb(extra));\n }\n });\n this._promptHandlersInitialized = true;\n }\n resource(name, uriOrTemplate, ...rest) {\n let metadata;\n if (typeof rest[0] === 'object') {\n metadata = rest.shift();\n }\n const readCallback = rest[0];\n if (typeof uriOrTemplate === 'string') {\n if (this._registeredResources[uriOrTemplate]) {\n throw new Error(`Resource ${uriOrTemplate} is already registered`);\n }\n const registeredResource = this._createRegisteredResource(name, undefined, uriOrTemplate, metadata, readCallback);\n this.setResourceRequestHandlers();\n this.sendResourceListChanged();\n return registeredResource;\n }\n else {\n if (this._registeredResourceTemplates[name]) {\n throw new Error(`Resource template ${name} is already registered`);\n }\n const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, undefined, uriOrTemplate, metadata, readCallback);\n this.setResourceRequestHandlers();\n this.sendResourceListChanged();\n return registeredResourceTemplate;\n }\n }\n registerResource(name, uriOrTemplate, config, readCallback) {\n if (typeof uriOrTemplate === 'string') {\n if (this._registeredResources[uriOrTemplate]) {\n throw new Error(`Resource ${uriOrTemplate} is already registered`);\n }\n const registeredResource = this._createRegisteredResource(name, config.title, uriOrTemplate, config, readCallback);\n this.setResourceRequestHandlers();\n this.sendResourceListChanged();\n return registeredResource;\n }\n else {\n if (this._registeredResourceTemplates[name]) {\n throw new Error(`Resource template ${name} is already registered`);\n }\n const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, config.title, uriOrTemplate, config, readCallback);\n this.setResourceRequestHandlers();\n this.sendResourceListChanged();\n return registeredResourceTemplate;\n }\n }\n _createRegisteredResource(name, title, uri, metadata, readCallback) {\n const registeredResource = {\n name,\n title,\n metadata,\n readCallback,\n enabled: true,\n disable: () => registeredResource.update({ enabled: false }),\n enable: () => registeredResource.update({ enabled: true }),\n remove: () => registeredResource.update({ uri: null }),\n update: updates => {\n if (typeof updates.uri !== 'undefined' && updates.uri !== uri) {\n delete this._registeredResources[uri];\n if (updates.uri)\n this._registeredResources[updates.uri] = registeredResource;\n }\n if (typeof updates.name !== 'undefined')\n registeredResource.name = updates.name;\n if (typeof updates.title !== 'undefined')\n registeredResource.title = updates.title;\n if (typeof updates.metadata !== 'undefined')\n registeredResource.metadata = updates.metadata;\n if (typeof updates.callback !== 'undefined')\n registeredResource.readCallback = updates.callback;\n if (typeof updates.enabled !== 'undefined')\n registeredResource.enabled = updates.enabled;\n this.sendResourceListChanged();\n }\n };\n this._registeredResources[uri] = registeredResource;\n return registeredResource;\n }\n _createRegisteredResourceTemplate(name, title, template, metadata, readCallback) {\n const registeredResourceTemplate = {\n resourceTemplate: template,\n title,\n metadata,\n readCallback,\n enabled: true,\n disable: () => registeredResourceTemplate.update({ enabled: false }),\n enable: () => registeredResourceTemplate.update({ enabled: true }),\n remove: () => registeredResourceTemplate.update({ name: null }),\n update: updates => {\n if (typeof updates.name !== 'undefined' && updates.name !== name) {\n delete this._registeredResourceTemplates[name];\n if (updates.name)\n this._registeredResourceTemplates[updates.name] = registeredResourceTemplate;\n }\n if (typeof updates.title !== 'undefined')\n registeredResourceTemplate.title = updates.title;\n if (typeof updates.template !== 'undefined')\n registeredResourceTemplate.resourceTemplate = updates.template;\n if (typeof updates.metadata !== 'undefined')\n registeredResourceTemplate.metadata = updates.metadata;\n if (typeof updates.callback !== 'undefined')\n registeredResourceTemplate.readCallback = updates.callback;\n if (typeof updates.enabled !== 'undefined')\n registeredResourceTemplate.enabled = updates.enabled;\n this.sendResourceListChanged();\n }\n };\n this._registeredResourceTemplates[name] = registeredResourceTemplate;\n // If the resource template has any completion callbacks, enable completions capability\n const variableNames = template.uriTemplate.variableNames;\n const hasCompleter = Array.isArray(variableNames) && variableNames.some(v => !!template.completeCallback(v));\n if (hasCompleter) {\n this.setCompletionRequestHandler();\n }\n return registeredResourceTemplate;\n }\n _createRegisteredPrompt(name, title, description, argsSchema, callback) {\n const registeredPrompt = {\n title,\n description,\n argsSchema: argsSchema === undefined ? undefined : objectFromShape(argsSchema),\n callback,\n enabled: true,\n disable: () => registeredPrompt.update({ enabled: false }),\n enable: () => registeredPrompt.update({ enabled: true }),\n remove: () => registeredPrompt.update({ name: null }),\n update: updates => {\n if (typeof updates.name !== 'undefined' && updates.name !== name) {\n delete this._registeredPrompts[name];\n if (updates.name)\n this._registeredPrompts[updates.name] = registeredPrompt;\n }\n if (typeof updates.title !== 'undefined')\n registeredPrompt.title = updates.title;\n if (typeof updates.description !== 'undefined')\n registeredPrompt.description = updates.description;\n if (typeof updates.argsSchema !== 'undefined')\n registeredPrompt.argsSchema = objectFromShape(updates.argsSchema);\n if (typeof updates.callback !== 'undefined')\n registeredPrompt.callback = updates.callback;\n if (typeof updates.enabled !== 'undefined')\n registeredPrompt.enabled = updates.enabled;\n this.sendPromptListChanged();\n }\n };\n this._registeredPrompts[name] = registeredPrompt;\n // If any argument uses a Completable schema, enable completions capability\n if (argsSchema) {\n const hasCompletable = Object.values(argsSchema).some(field => {\n const inner = field instanceof ZodOptional ? field._def?.innerType : field;\n return isCompletable(inner);\n });\n if (hasCompletable) {\n this.setCompletionRequestHandler();\n }\n }\n return registeredPrompt;\n }\n _createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, execution, _meta, handler) {\n // Validate tool name according to SEP specification\n validateAndWarnToolName(name);\n const registeredTool = {\n title,\n description,\n inputSchema: getZodSchemaObject(inputSchema),\n outputSchema: getZodSchemaObject(outputSchema),\n annotations,\n execution,\n _meta,\n handler: handler,\n enabled: true,\n disable: () => registeredTool.update({ enabled: false }),\n enable: () => registeredTool.update({ enabled: true }),\n remove: () => registeredTool.update({ name: null }),\n update: updates => {\n if (typeof updates.name !== 'undefined' && updates.name !== name) {\n if (typeof updates.name === 'string') {\n validateAndWarnToolName(updates.name);\n }\n delete this._registeredTools[name];\n if (updates.name)\n this._registeredTools[updates.name] = registeredTool;\n }\n if (typeof updates.title !== 'undefined')\n registeredTool.title = updates.title;\n if (typeof updates.description !== 'undefined')\n registeredTool.description = updates.description;\n if (typeof updates.paramsSchema !== 'undefined')\n registeredTool.inputSchema = objectFromShape(updates.paramsSchema);\n if (typeof updates.outputSchema !== 'undefined')\n registeredTool.outputSchema = objectFromShape(updates.outputSchema);\n if (typeof updates.callback !== 'undefined')\n registeredTool.handler = updates.callback;\n if (typeof updates.annotations !== 'undefined')\n registeredTool.annotations = updates.annotations;\n if (typeof updates._meta !== 'undefined')\n registeredTool._meta = updates._meta;\n if (typeof updates.enabled !== 'undefined')\n registeredTool.enabled = updates.enabled;\n this.sendToolListChanged();\n }\n };\n this._registeredTools[name] = registeredTool;\n this.setToolRequestHandlers();\n this.sendToolListChanged();\n return registeredTool;\n }\n /**\n * tool() implementation. Parses arguments passed to overrides defined above.\n */\n tool(name, ...rest) {\n if (this._registeredTools[name]) {\n throw new Error(`Tool ${name} is already registered`);\n }\n let description;\n let inputSchema;\n let outputSchema;\n let annotations;\n // Tool properties are passed as separate arguments, with omissions allowed.\n // Support for this style is frozen as of protocol version 2025-03-26. Future additions\n // to tool definition should *NOT* be added.\n if (typeof rest[0] === 'string') {\n description = rest.shift();\n }\n // Handle the different overload combinations\n if (rest.length > 1) {\n // We have at least one more arg before the callback\n const firstArg = rest[0];\n if (isZodRawShapeCompat(firstArg)) {\n // We have a params schema as the first arg\n inputSchema = rest.shift();\n // Check if the next arg is potentially annotations\n if (rest.length > 1 && typeof rest[0] === 'object' && rest[0] !== null && !isZodRawShapeCompat(rest[0])) {\n // Case: tool(name, paramsSchema, annotations, cb)\n // Or: tool(name, description, paramsSchema, annotations, cb)\n annotations = rest.shift();\n }\n }\n else if (typeof firstArg === 'object' && firstArg !== null) {\n // Not a ZodRawShapeCompat, so must be annotations in this position\n // Case: tool(name, annotations, cb)\n // Or: tool(name, description, annotations, cb)\n annotations = rest.shift();\n }\n }\n const callback = rest[0];\n return this._createRegisteredTool(name, undefined, description, inputSchema, outputSchema, annotations, { taskSupport: 'forbidden' }, undefined, callback);\n }\n /**\n * Registers a tool with a config object and callback.\n */\n registerTool(name, config, cb) {\n if (this._registeredTools[name]) {\n throw new Error(`Tool ${name} is already registered`);\n }\n const { title, description, inputSchema, outputSchema, annotations, _meta } = config;\n return this._createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, { taskSupport: 'forbidden' }, _meta, cb);\n }\n prompt(name, ...rest) {\n if (this._registeredPrompts[name]) {\n throw new Error(`Prompt ${name} is already registered`);\n }\n let description;\n if (typeof rest[0] === 'string') {\n description = rest.shift();\n }\n let argsSchema;\n if (rest.length > 1) {\n argsSchema = rest.shift();\n }\n const cb = rest[0];\n const registeredPrompt = this._createRegisteredPrompt(name, undefined, description, argsSchema, cb);\n this.setPromptRequestHandlers();\n this.sendPromptListChanged();\n return registeredPrompt;\n }\n /**\n * Registers a prompt with a config object and callback.\n */\n registerPrompt(name, config, cb) {\n if (this._registeredPrompts[name]) {\n throw new Error(`Prompt ${name} is already registered`);\n }\n const { title, description, argsSchema } = config;\n const registeredPrompt = this._createRegisteredPrompt(name, title, description, argsSchema, cb);\n this.setPromptRequestHandlers();\n this.sendPromptListChanged();\n return registeredPrompt;\n }\n /**\n * Checks if the server is connected to a transport.\n * @returns True if the server is connected\n */\n isConnected() {\n return this.server.transport !== undefined;\n }\n /**\n * Sends a logging message to the client, if connected.\n * Note: You only need to send the parameters object, not the entire JSON RPC message\n * @see LoggingMessageNotification\n * @param params\n * @param sessionId optional for stateless and backward compatibility\n */\n async sendLoggingMessage(params, sessionId) {\n return this.server.sendLoggingMessage(params, sessionId);\n }\n /**\n * Sends a resource list changed event to the client, if connected.\n */\n sendResourceListChanged() {\n if (this.isConnected()) {\n this.server.sendResourceListChanged();\n }\n }\n /**\n * Sends a tool list changed event to the client, if connected.\n */\n sendToolListChanged() {\n if (this.isConnected()) {\n this.server.sendToolListChanged();\n }\n }\n /**\n * Sends a prompt list changed event to the client, if connected.\n */\n sendPromptListChanged() {\n if (this.isConnected()) {\n this.server.sendPromptListChanged();\n }\n }\n}\n/**\n * A resource template combines a URI pattern with optional functionality to enumerate\n * all resources matching that pattern.\n */\nexport class ResourceTemplate {\n constructor(uriTemplate, _callbacks) {\n this._callbacks = _callbacks;\n this._uriTemplate = typeof uriTemplate === 'string' ? new UriTemplate(uriTemplate) : uriTemplate;\n }\n /**\n * Gets the URI template pattern.\n */\n get uriTemplate() {\n return this._uriTemplate;\n }\n /**\n * Gets the list callback, if one was provided.\n */\n get listCallback() {\n return this._callbacks.list;\n }\n /**\n * Gets the callback for completing a specific URI template variable, if one was provided.\n */\n completeCallback(variable) {\n return this._callbacks.complete?.[variable];\n }\n}\nconst EMPTY_OBJECT_JSON_SCHEMA = {\n type: 'object',\n properties: {}\n};\n/**\n * Checks if a value looks like a Zod schema by checking for parse/safeParse methods.\n */\nfunction isZodTypeLike(value) {\n return (value !== null &&\n typeof value === 'object' &&\n 'parse' in value &&\n typeof value.parse === 'function' &&\n 'safeParse' in value &&\n typeof value.safeParse === 'function');\n}\n/**\n * Checks if an object is a Zod schema instance (v3 or v4).\n *\n * Zod schemas have internal markers:\n * - v3: `_def` property\n * - v4: `_zod` property\n *\n * This includes transformed schemas like z.preprocess(), z.transform(), z.pipe().\n */\nfunction isZodSchemaInstance(obj) {\n return '_def' in obj || '_zod' in obj || isZodTypeLike(obj);\n}\n/**\n * Checks if an object is a \"raw shape\" - a plain object where values are Zod schemas.\n *\n * Raw shapes are used as shorthand: `{ name: z.string() }` instead of `z.object({ name: z.string() })`.\n *\n * IMPORTANT: This must NOT match actual Zod schema instances (like z.preprocess, z.pipe),\n * which have internal properties that could be mistaken for schema values.\n */\nfunction isZodRawShapeCompat(obj) {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n // If it's already a Zod schema instance, it's NOT a raw shape\n if (isZodSchemaInstance(obj)) {\n return false;\n }\n // Empty objects are valid raw shapes (tools with no parameters)\n if (Object.keys(obj).length === 0) {\n return true;\n }\n // A raw shape has at least one property that is a Zod schema\n return Object.values(obj).some(isZodTypeLike);\n}\n/**\n * Converts a provided Zod schema to a Zod object if it is a ZodRawShapeCompat,\n * otherwise returns the schema as is.\n */\nfunction getZodSchemaObject(schema) {\n if (!schema) {\n return undefined;\n }\n if (isZodRawShapeCompat(schema)) {\n return objectFromShape(schema);\n }\n return schema;\n}\nfunction promptArgumentsFromSchema(schema) {\n const shape = getObjectShape(schema);\n if (!shape)\n return [];\n return Object.entries(shape).map(([name, field]) => {\n // Get description - works for both v3 and v4\n const description = getSchemaDescription(field);\n // Check if optional - works for both v3 and v4\n const isOptional = isSchemaOptional(field);\n return {\n name,\n description,\n required: !isOptional\n };\n });\n}\nfunction getMethodValue(schema) {\n const shape = getObjectShape(schema);\n const methodSchema = shape?.method;\n if (!methodSchema) {\n throw new Error('Schema is missing a method literal');\n }\n // Extract literal value - works for both v3 and v4\n const value = getLiteralValue(methodSchema);\n if (typeof value === 'string') {\n return value;\n }\n throw new Error('Schema method literal must be a string');\n}\nfunction createCompletionResult(suggestions) {\n return {\n completion: {\n values: suggestions.slice(0, 100),\n total: suggestions.length,\n hasMore: suggestions.length > 100\n }\n };\n}\nconst EMPTY_COMPLETION_RESULT = {\n completion: {\n values: [],\n hasMore: false\n }\n};\n//# sourceMappingURL=mcp.js.map"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAcO,MAAM,UAAU;AAAA,EACnB,YAAY,YAAY,SAAS;AAC7B,SAAK,uBAAuB,CAAA;AAC5B,SAAK,+BAA+B,CAAA;AACpC,SAAK,mBAAmB,CAAA;AACxB,SAAK,qBAAqB,CAAA;AAC1B,SAAK,2BAA2B;AAChC,SAAK,gCAAgC;AACrC,SAAK,+BAA+B;AACpC,SAAK,6BAA6B;AAClC,SAAK,SAAS,IAAI,OAAO,YAAY,OAAO;AAAA,EAChD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAI,eAAe;AACf,QAAI,CAAC,KAAK,eAAe;AACrB,WAAK,gBAAgB;AAAA,QACjB,OAAO,IAAI,2BAA2B,IAAI;AAAA,MAC1D;AAAA,IACQ;AACA,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,QAAQ,WAAW;AACrB,WAAO,MAAM,KAAK,OAAO,QAAQ,SAAS;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA,EAIA,MAAM,QAAQ;AACV,UAAM,KAAK,OAAO,MAAK;AAAA,EAC3B;AAAA,EACA,yBAAyB;AACrB,QAAI,KAAK,0BAA0B;AAC/B;AAAA,IACJ;AACA,SAAK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;AAC5B,MAAI,CAAC,cAAc;AACf,UAAM,IAAI,MAAM,oCAAoC;AAAA,EACxD;AAEA,QAAM,QAAQ,gBAAgB,YAAY;AAC1C,MAAI,OAAO,UAAU,UAAU;AAC3B,WAAO;AAAA,EACX;AACA,QAAM,IAAI,MAAM,wCAAwC;AAC5D;AACA,SAAS,uBAAuB,aAAa;AACzC,SAAO;AAAA,IACH,YAAY;AAAA,MACR,QAAQ,YAAY,MAAM,GAAG,GAAG;AAAA,MAChC,OAAO,YAAY;AAAA,MACnB,SAAS,YAAY,SAAS;AAAA,IAC1C;AAAA,EACA;AACA;AACA,MAAM,0BAA0B;AAAA,EAC5B,YAAY;AAAA,IACR,QAAQ,CAAA;AAAA,IACR,SAAS;AAAA,EACjB;AACA;","x_google_ignoreList":[0]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sources":["../../../../../../../../../../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js"],"sourcesContent":["import process from 'node:process';\nimport { ReadBuffer, serializeMessage } from '../shared/stdio.js';\n/**\n * Server transport for stdio: this communicates with an MCP client by reading from the current process' stdin and writing to stdout.\n *\n * This transport is only available in Node.js environments.\n */\nexport class StdioServerTransport {\n constructor(_stdin = process.stdin, _stdout = process.stdout) {\n this._stdin = _stdin;\n this._stdout = _stdout;\n this._readBuffer = new ReadBuffer();\n this._started = false;\n // Arrow functions to bind `this` properly, while maintaining function identity.\n this._ondata = (chunk) => {\n this._readBuffer.append(chunk);\n this.processReadBuffer();\n };\n this._onerror = (error) => {\n this.onerror?.(error);\n };\n }\n /**\n * Starts listening for messages on stdin.\n */\n async start() {\n if (this._started) {\n throw new Error('StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.');\n }\n this._started = true;\n this._stdin.on('data', this._ondata);\n this._stdin.on('error', this._onerror);\n }\n processReadBuffer() {\n while (true) {\n try {\n const message = this._readBuffer.readMessage();\n if (message === null) {\n break;\n }\n this.onmessage?.(message);\n }\n catch (error) {\n this.onerror?.(error);\n }\n }\n }\n async close() {\n // Remove our event listeners first\n this._stdin.off('data', this._ondata);\n this._stdin.off('error', this._onerror);\n // Check if we were the only data listener\n const remainingDataListeners = this._stdin.listenerCount('data');\n if (remainingDataListeners === 0) {\n // Only pause stdin if we were the only listener\n // This prevents interfering with other parts of the application that might be using stdin\n this._stdin.pause();\n }\n // Clear the buffer and notify closure\n this._readBuffer.clear();\n this.onclose?.();\n }\n send(message) {\n return new Promise(resolve => {\n const json = serializeMessage(message);\n if (this._stdout.write(json)) {\n resolve();\n }\n else {\n this._stdout.once('drain', resolve);\n }\n });\n }\n}\n//# sourceMappingURL=stdio.js.map"],"names":[],"mappings":";;;;;;;;;;AAOO,MAAM,qBAAqB;AAAA,EAC9B,YAAY,SAAS,QAAQ,OAAO,UAAU,QAAQ,QAAQ;AAC1D,SAAK,SAAS;AACd,SAAK,UAAU;AACf,SAAK,cAAc,IAAI,WAAU;AACjC,SAAK,WAAW;AAEhB,SAAK,UAAU,CAAC,UAAU;AACtB,WAAK,YAAY,OAAO,KAAK;AAC7B,WAAK,kBAAiB;AAAA,IAC1B;AACA,SAAK,WAAW,CAAC,UAAU;AACvB,WAAK,UAAU,KAAK;AAAA,IACxB;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA,EAIA,MAAM,QAAQ;AACV,QAAI,KAAK,UAAU;AACf,YAAM,IAAI,MAAM,+GAA+G;AAAA,IACnI;AACA,SAAK,WAAW;AAChB,SAAK,OAAO,GAAG,QAAQ,KAAK,OAAO;AACnC,SAAK,OAAO,GAAG,SAAS,KAAK,QAAQ;AAAA,EACzC;AAAA,EACA,oBAAoB;AAChB,WAAO,MAAM;AACT,UAAI;AACA,cAAM,UAAU,KAAK,YAAY,YAAW;AAC5C,YAAI,YAAY,MAAM;AAClB;AAAA,QACJ;AACA,aAAK,YAAY,OAAO;AAAA,MAC5B,SACO,OAAO;AACV,aAAK,UAAU,KAAK;AAAA,MACxB;AAAA,IACJ;AAAA,EACJ;AAAA,EACA,MAAM,QAAQ;AAEV,SAAK,OAAO,IAAI,QAAQ,KAAK,OAAO;AACpC,SAAK,OAAO,IAAI,SAAS,KAAK,QAAQ;AAEtC,UAAM,yBAAyB,KAAK,OAAO,cAAc,MAAM;AAC/D,QAAI,2BAA2B,GAAG;AAG9B,WAAK,OAAO,MAAK;AAAA,IACrB;AAEA,SAAK,YAAY,MAAK;AACtB,SAAK,UAAO;AAAA,EAChB;AAAA,EACA,KAAK,SAAS;AACV,WAAO,IAAI,QAAQ,aAAW;AAC1B,YAAM,OAAO,iBAAiB,OAAO;AACrC,UAAI,KAAK,QAAQ,MAAM,IAAI,GAAG;AAC1B,gBAAO;AAAA,MACX,OACK;AACD,aAAK,QAAQ,KAAK,SAAS,OAAO;AAAA,MACtC;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;","x_google_ignoreList":[0]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zod-compat.js","sources":["../../../../../../../../../../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js"],"sourcesContent":["// zod-compat.ts\n// ----------------------------------------------------\n// Unified types + helpers to accept Zod v3 and v4 (Mini)\n// ----------------------------------------------------\nimport * as z3rt from 'zod/v3';\nimport * as z4mini from 'zod/v4-mini';\n// --- Runtime detection ---\nexport function isZ4Schema(s) {\n // Present on Zod 4 (Classic & Mini) schemas; absent on Zod 3\n const schema = s;\n return !!schema._zod;\n}\n// --- Schema construction ---\nexport function objectFromShape(shape) {\n const values = Object.values(shape);\n if (values.length === 0)\n return z4mini.object({}); // default to v4 Mini\n const allV4 = values.every(isZ4Schema);\n const allV3 = values.every(s => !isZ4Schema(s));\n if (allV4)\n return z4mini.object(shape);\n if (allV3)\n return z3rt.object(shape);\n throw new Error('Mixed Zod versions detected in object shape.');\n}\n// --- Unified parsing ---\nexport function safeParse(schema, data) {\n if (isZ4Schema(schema)) {\n // Mini exposes top-level safeParse\n const result = z4mini.safeParse(schema, data);\n return result;\n }\n const v3Schema = schema;\n const result = v3Schema.safeParse(data);\n return result;\n}\nexport async function safeParseAsync(schema, data) {\n if (isZ4Schema(schema)) {\n // Mini exposes top-level safeParseAsync\n const result = await z4mini.safeParseAsync(schema, data);\n return result;\n }\n const v3Schema = schema;\n const result = await v3Schema.safeParseAsync(data);\n return result;\n}\n// --- Shape extraction ---\nexport function getObjectShape(schema) {\n if (!schema)\n return undefined;\n // Zod v3 exposes `.shape`; Zod v4 keeps the shape on `_zod.def.shape`\n let rawShape;\n if (isZ4Schema(schema)) {\n const v4Schema = schema;\n rawShape = v4Schema._zod?.def?.shape;\n }\n else {\n const v3Schema = schema;\n rawShape = v3Schema.shape;\n }\n if (!rawShape)\n return undefined;\n if (typeof rawShape === 'function') {\n try {\n return rawShape();\n }\n catch {\n return undefined;\n }\n }\n return rawShape;\n}\n// --- Schema normalization ---\n/**\n * Normalizes a schema to an object schema. Handles both:\n * - Already-constructed object schemas (v3 or v4)\n * - Raw shapes that need to be wrapped into object schemas\n */\nexport function normalizeObjectSchema(schema) {\n if (!schema)\n return undefined;\n // First check if it's a raw shape (Record<string, AnySchema>)\n // Raw shapes don't have _def or _zod properties and aren't schemas themselves\n if (typeof schema === 'object') {\n // Check if it's actually a ZodRawShapeCompat (not a schema instance)\n // by checking if it lacks schema-like internal properties\n const asV3 = schema;\n const asV4 = schema;\n // If it's not a schema instance (no _def or _zod), it might be a raw shape\n if (!asV3._def && !asV4._zod) {\n // Check if all values are schemas (heuristic to confirm it's a raw shape)\n const values = Object.values(schema);\n if (values.length > 0 &&\n values.every(v => typeof v === 'object' &&\n v !== null &&\n (v._def !== undefined ||\n v._zod !== undefined ||\n typeof v.parse === 'function'))) {\n return objectFromShape(schema);\n }\n }\n }\n // If we get here, it should be an AnySchema (not a raw shape)\n // Check if it's already an object schema\n if (isZ4Schema(schema)) {\n // Check if it's a v4 object\n const v4Schema = schema;\n const def = v4Schema._zod?.def;\n if (def && (def.type === 'object' || def.shape !== undefined)) {\n return schema;\n }\n }\n else {\n // Check if it's a v3 object\n const v3Schema = schema;\n if (v3Schema.shape !== undefined) {\n return schema;\n }\n }\n return undefined;\n}\n// --- Error message extraction ---\n/**\n * Safely extracts an error message from a parse result error.\n * Zod errors can have different structures, so we handle various cases.\n */\nexport function getParseErrorMessage(error) {\n if (error && typeof error === 'object') {\n // Try common error structures\n if ('message' in error && typeof error.message === 'string') {\n return error.message;\n }\n if ('issues' in error && Array.isArray(error.issues) && error.issues.length > 0) {\n const firstIssue = error.issues[0];\n if (firstIssue && typeof firstIssue === 'object' && 'message' in firstIssue) {\n return String(firstIssue.message);\n }\n }\n // Fallback: try to stringify the error\n try {\n return JSON.stringify(error);\n }\n catch {\n return String(error);\n }\n }\n return String(error);\n}\n// --- Schema metadata access ---\n/**\n * Gets the description from a schema, if available.\n * Works with both Zod v3 and v4.\n *\n * Both versions expose a `.description` getter that returns the description\n * from their respective internal storage (v3: _def, v4: globalRegistry).\n */\nexport function getSchemaDescription(schema) {\n return schema.description;\n}\n/**\n * Checks if a schema is optional.\n * Works with both Zod v3 and v4.\n */\nexport function isSchemaOptional(schema) {\n if (isZ4Schema(schema)) {\n const v4Schema = schema;\n return v4Schema._zod?.def?.type === 'optional';\n }\n const v3Schema = schema;\n // v3 has isOptional() method\n if (typeof schema.isOptional === 'function') {\n return schema.isOptional();\n }\n return v3Schema._def?.typeName === 'ZodOptional';\n}\n/**\n * Gets the literal value from a schema, if it's a literal schema.\n * Works with both Zod v3 and v4.\n * Returns undefined if the schema is not a literal or the value cannot be determined.\n */\nexport function getLiteralValue(schema) {\n if (isZ4Schema(schema)) {\n const v4Schema = schema;\n const def = v4Schema._zod?.def;\n if (def) {\n // Try various ways to get the literal value\n if (def.value !== undefined)\n return def.value;\n if (Array.isArray(def.values) && def.values.length > 0) {\n return def.values[0];\n }\n }\n }\n const v3Schema = schema;\n const def = v3Schema._def;\n if (def) {\n if (def.value !== undefined)\n return def.value;\n if (Array.isArray(def.values) && def.values.length > 0) {\n return def.values[0];\n }\n }\n // Fallback: check for direct value property (some Zod versions)\n const directValue = schema.value;\n if (directValue !== undefined)\n return directValue;\n return undefined;\n}\n//# sourceMappingURL=zod-compat.js.map"],"names":["z4mini.object","z3rt.object","result","z4mini.safeParse","z4mini.safeParseAsync","def"],"mappings":";;;;;;;;;;;AAOO,SAAS,WAAW,GAAG;AAE1B,QAAM,SAAS;AACf,SAAO,CAAC,CAAC,OAAO;AACpB;AAEO,SAAS,gBAAgB,OAAO;AACnC,QAAM,SAAS,OAAO,OAAO,KAAK;AAClC,MAAI,OAAO,WAAW;AAClB,WAAOA,OAAc,CAAA,CAAE;AAC3B,QAAM,QAAQ,OAAO,MAAM,UAAU;AACrC,QAAM,QAAQ,OAAO,MAAM,OAAK,CAAC,WAAW,CAAC,CAAC;AAC9C,MAAI;AACA,WAAOA,OAAc,KAAK;AAC9B,MAAI;AACA,WAAOC,WAAY,KAAK;AAC5B,QAAM,IAAI,MAAM,8CAA8C;AAClE;AAEO,SAAS,UAAU,QAAQ,MAAM;AACpC,MAAI,WAAW,MAAM,GAAG;AAEpB,UAAMC,UAASC,YAAiB,QAAQ,IAAI;AAC5C,WAAOD;AAAA,EACX;AACA,QAAM,WAAW;AACjB,QAAM,SAAS,SAAS,UAAU,IAAI;AACtC,SAAO;AACX;AACO,eAAe,eAAe,QAAQ,MAAM;AAC/C,MAAI,WAAW,MAAM,GAAG;AAEpB,UAAMA,UAAS,MAAME,iBAAsB,QAAQ,IAAI;AACvD,WAAOF;AAAA,EACX;AACA,QAAM,WAAW;AACjB,QAAM,SAAS,MAAM,SAAS,eAAe,IAAI;AACjD,SAAO;AACX;AAEO,SAAS,eAAe,QAAQ;AACnC,MAAI,CAAC;AACD,WAAO;AAEX,MAAI;AACJ,MAAI,WAAW,MAAM,GAAG;AACpB,UAAM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YAAY,aAAa,YAAY;AACzE,eAAO,OAAO,WAAW,OAAO;AAAA,MACpC;AAAA,IACJ;AAEA,QAAI;AACA,aAAO,KAAK,UAAU,KAAK;AAAA,IAC/B,QACM;AACF,aAAO,OAAO,KAAK;AAAA,IACvB;AAAA,EACJ;AACA,SAAO,OAAO,KAAK;AACvB;AASO,SAAS,qBAAqB,QAAQ;AACzC,SAAO,OAAO;AAClB;AAKO,SAAS,iBAAiB,QAAQ;AACrC,MAAI,WAAW,MAAM,GAAG;AACpB,UAAM,WAAW;AACjB,WAAO,SAAS,MAAM,KAAK,SAAS;AAAA,EACxC;AACA,QAAM,WAAW;AAEjB,MAAI,OAAO,OAAO,eAAe,YAAY;AACzC,WAAO,OAAO,WAAU;AAAA,EAC5B;AACA,SAAO,SAAS,MAAM,aAAa;AACvC;AAMO,SAAS,gBAAgB,QAAQ;AACpC,MAAI,WAAW,MAAM,GAAG;AACpB,UAAM,WAAW;AACjB,UAAMG,OAAM,SAAS,MAAM;AAC3B,QAAIA,MAAK;AAEL,UAAIA,KAAI,UAAU;AACd,eAAOA,KAAI;AACf,UAAI,MAAM,QAAQA,KAAI,MAAM,KAAKA,KAAI,OAAO,SAAS,GAAG;AACpD,eAAOA,KAAI,OAAO,CAAC;AAAA,MACvB;AAAA,IACJ;AAAA,EACJ;AACA,QAAM,WAAW;AACjB,QAAM,MAAM,SAAS;AACrB,MAAI,KAAK;AACL,QAAI,IAAI,UAAU;AACd,aAAO,IAAI;AACf,QAAI,MAAM,QAAQ,IAAI,MAAM,KAAK,IAAI,OAAO,SAAS,GAAG;AACpD,aAAO,IAAI,OAAO,CAAC;AAAA,IACvB;AAAA,EACJ;AAEA,QAAM,cAAc,OAAO;AAC3B,MAAI,gBAAgB;AAChB,WAAO;AACX,SAAO;AACX;","x_google_ignoreList":[0]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zod-json-schema-compat.js","sources":["../../../../../../../../../../../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.25.2_hono@4.12.8_zod@4.1.13/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js"],"sourcesContent":["// zod-json-schema-compat.ts\n// ----------------------------------------------------\n// JSON Schema conversion for both Zod v3 and Zod v4 (Mini)\n// v3 uses your vendored converter; v4 uses Mini's toJSONSchema\n// ----------------------------------------------------\nimport * as z4mini from 'zod/v4-mini';\nimport { getObjectShape, safeParse, isZ4Schema, getLiteralValue } from './zod-compat.js';\nimport { zodToJsonSchema } from 'zod-to-json-schema';\nfunction mapMiniTarget(t) {\n if (!t)\n return 'draft-7';\n if (t === 'jsonSchema7' || t === 'draft-7')\n return 'draft-7';\n if (t === 'jsonSchema2019-09' || t === 'draft-2020-12')\n return 'draft-2020-12';\n return 'draft-7'; // fallback\n}\nexport function toJsonSchemaCompat(schema, opts) {\n if (isZ4Schema(schema)) {\n // v4 branch — use Mini's built-in toJSONSchema\n return z4mini.toJSONSchema(schema, {\n target: mapMiniTarget(opts?.target),\n io: opts?.pipeStrategy ?? 'input'\n });\n }\n // v3 branch — use vendored converter\n return zodToJsonSchema(schema, {\n strictUnions: opts?.strictUnions ?? true,\n pipeStrategy: opts?.pipeStrategy ?? 'input'\n });\n}\nexport function getMethodLiteral(schema) {\n const shape = getObjectShape(schema);\n const methodSchema = shape?.method;\n if (!methodSchema) {\n throw new Error('Schema is missing a method literal');\n }\n const value = getLiteralValue(methodSchema);\n if (typeof value !== 'string') {\n throw new Error('Schema method literal must be a string');\n }\n return value;\n}\nexport function parseWithCompat(schema, data) {\n const result = safeParse(schema, data);\n if (!result.success) {\n throw result.error;\n }\n return result.data;\n}\n//# sourceMappingURL=zod-json-schema-compat.js.map"],"names":["z4mini.toJSONSchema"],"mappings":";;;;;;;;;;;;AAQA,SAAS,cAAc,GAAG;AACtB,MAAI,CAAC;AACD,WAAO;AACX,MAAI,MAAM,iBAAiB,MAAM;AAC7B,WAAO;AACX,MAAI,MAAM,uBAAuB,MAAM;AACnC,WAAO;AACX,SAAO;AACX;AACO,SAAS,mBAAmB,QAAQ,MAAM;AAC7C,MAAI,WAAW,MAAM,GAAG;AAEpB,WAAOA,aAAoB,QAAQ;AAAA,MAC/B,QAAQ,cAAc,MAAM,MAAM;AAAA,MAClC,IAAI,MAAM,gBAAgB;AAAA,IACtC,CAAS;AAAA,EACL;AAEA,SAAO,gBAAgB,QAAQ;AAAA,IAC3B,cAAc,MAAM,gBAAgB;AAAA,IACpC,cAAc,MAAM,gBAAgB;AAAA,EAC5C,CAAK;AACL;AACO,SAAS,iBAAiB,QAAQ;AACrC,QAAM,QAAQ,eAAe,MAAM;AACnC,QAAM,eAAe,OAAO;AAC5B,MAAI,CAAC,cAAc;AACf,UAAM,IAAI,MAAM,oCAAoC;AAAA,EACxD;AACA,QAAM,QAAQ,gBAAgB,YAAY;AAC1C,MAAI,OAAO,UAAU,UAAU;AAC3B,UAAM,IAAI,MAAM,wCAAwC;AAAA,EAC5D;AACA,SAAO;AACX;AACO,SAAS,gBAAgB,QAAQ,MAAM;AAC1C,QAAM,SAAS,UAAU,QAAQ,IAAI;AACrC,MAAI,CAAC,OAAO,SAAS;AACjB,UAAM,OAAO;AAAA,EACjB;AACA,SAAO,OAAO;AAClB;","x_google_ignoreList":[0]}
|