{"version":3,"file":"src-Pa1iAvsj.mjs","names":["code: OAuthErrorCode | string","errorUri?: string","response: OAuthErrorResponse","code: SdkErrorCode","data?: unknown","code: number","data?: unknown","JSONValueSchema: z.ZodType<JSONValue, JSONValue>","JSONObjectSchema: z.ZodType<JSONObject, JSONObject>","JSONArraySchema: z.ZodType<JSONArray, JSONArray>","resultSchemas: Record<string, z.core.$ZodType>","map: Record<string, T>","_specTypeSchemas: Record<string, StandardSchemaV1>","_isSpecType: Record<string, (value: unknown) => boolean>","schemas","specTypeSchemas: SchemaRecord","isSpecType: GuardRecord","result: Record<string, unknown>","_options?: ProtocolOptions","errorResponse: JSONRPCErrorResponse","baseCtx: BaseContext","response: JSONRPCResponse","onAbort: (() => void) | undefined","cleanupMessageId: number | undefined","jsonrpcRequest: JSONRPCRequest","jsonrpcNotification: JSONRPCNotification","stored: (request: JSONRPCRequest, ctx: ContextT) => Promise<Result>","result: T","warnings: string[]","parts: Array<string | { name: string; operator: string; names: string[]; exploded: boolean }>","name","value","patterns: Array<{ pattern: string; name: string }>","pattern: string","names: Array<{ name: string; exploded: boolean }>","result: Variables"],"sources":["../../core-internal/src/auth/errors.ts","../../core-internal/src/errors/sdkErrors.ts","../../core-internal/src/shared/auth.ts","../../core-internal/src/shared/authUtils.ts","../../core-internal/src/shared/metadataUtils.ts","../../core-internal/src/types/constants.ts","../../core-internal/src/types/enums.ts","../../core-internal/src/types/errors.ts","../../core-internal/src/types/schemas.ts","../../core-internal/src/types/guards.ts","../../core-internal/src/types/specTypeSchema.ts","../../core-internal/src/util/standardSchema.ts","../../core-internal/src/shared/protocol.ts","../../core-internal/src/shared/stdio.ts","../../core-internal/src/shared/toolNameValidation.ts","../../core-internal/src/shared/transport.ts","../../core-internal/src/shared/uriTemplate.ts","../../core-internal/src/util/inMemory.ts","../../core-internal/src/util/schema.ts","../../core-internal/src/util/zodCompat.ts","../../core-internal/src/validators/fromJsonSchema.ts"],"sourcesContent":["import type { OAuthErrorResponse } from '../shared/auth';\n\n/**\n * OAuth error codes as defined by {@link https://datatracker.ietf.org/doc/html/rfc6749#section-5.2 | RFC 6749}\n * and extensions.\n */\nexport enum OAuthErrorCode {\n    /**\n     * The request is missing a required parameter, includes an invalid parameter value,\n     * includes a parameter more than once, or is otherwise malformed.\n     */\n    InvalidRequest = 'invalid_request',\n\n    /**\n     * Client authentication failed (e.g., unknown client, no client authentication included,\n     * or unsupported authentication method).\n     */\n    InvalidClient = 'invalid_client',\n\n    /**\n     * The provided authorization grant or refresh token is invalid, expired, revoked,\n     * does not match the redirection URI used in the authorization request, or was issued to another client.\n     */\n    InvalidGrant = 'invalid_grant',\n\n    /**\n     * The authenticated client is not authorized to use this authorization grant type.\n     */\n    UnauthorizedClient = 'unauthorized_client',\n\n    /**\n     * The authorization grant type is not supported by the authorization server.\n     */\n    UnsupportedGrantType = 'unsupported_grant_type',\n\n    /**\n     * The requested scope is invalid, unknown, malformed, or exceeds the scope granted by the resource owner.\n     */\n    InvalidScope = 'invalid_scope',\n\n    /**\n     * The resource owner or authorization server denied the request.\n     */\n    AccessDenied = 'access_denied',\n\n    /**\n     * The authorization server encountered an unexpected condition that prevented it from fulfilling the request.\n     */\n    ServerError = 'server_error',\n\n    /**\n     * The authorization server is currently unable to handle the request due to temporary overloading or maintenance.\n     */\n    TemporarilyUnavailable = 'temporarily_unavailable',\n\n    /**\n     * The authorization server does not support obtaining an authorization code using this method.\n     */\n    UnsupportedResponseType = 'unsupported_response_type',\n\n    /**\n     * The authorization server does not support the requested token type.\n     */\n    UnsupportedTokenType = 'unsupported_token_type',\n\n    /**\n     * The access token provided is expired, revoked, malformed, or invalid for other reasons.\n     */\n    InvalidToken = 'invalid_token',\n\n    /**\n     * The HTTP method used is not allowed for this endpoint. (Custom, non-standard error)\n     */\n    MethodNotAllowed = 'method_not_allowed',\n\n    /**\n     * Rate limit exceeded. (Custom, non-standard error based on RFC 6585)\n     */\n    TooManyRequests = 'too_many_requests',\n\n    /**\n     * The client metadata is invalid. (Custom error for dynamic client registration - RFC 7591)\n     */\n    InvalidClientMetadata = 'invalid_client_metadata',\n\n    /**\n     * The request requires higher privileges than provided by the access token.\n     */\n    InsufficientScope = 'insufficient_scope',\n\n    /**\n     * The requested resource is invalid, missing, unknown, or malformed. (Custom error for resource indicators - RFC 8707)\n     */\n    InvalidTarget = 'invalid_target'\n}\n\n/**\n * OAuth error class for all OAuth-related errors.\n */\nexport class OAuthError extends Error {\n    constructor(\n        public readonly code: OAuthErrorCode | string,\n        message: string,\n        public readonly errorUri?: string\n    ) {\n        super(message);\n        this.name = 'OAuthError';\n    }\n\n    /**\n     * Converts the error to a standard OAuth error response object.\n     */\n    toResponseObject(): OAuthErrorResponse {\n        const response: OAuthErrorResponse = {\n            error: this.code,\n            error_description: this.message\n        };\n\n        if (this.errorUri) {\n            response.error_uri = this.errorUri;\n        }\n\n        return response;\n    }\n\n    /**\n     * Creates an {@linkcode OAuthError} from an OAuth error response.\n     */\n    static fromResponse(response: OAuthErrorResponse): OAuthError {\n        return new OAuthError(response.error as OAuthErrorCode, response.error_description ?? response.error, response.error_uri);\n    }\n}\n","/**\n * Error codes for SDK errors (local errors that never cross the wire).\n * Unlike {@linkcode ProtocolErrorCode} which uses numeric JSON-RPC codes, `SdkErrorCode` uses\n * descriptive string values for better developer experience.\n *\n * These errors are thrown locally by the SDK and are never serialized as\n * JSON-RPC error responses.\n */\nexport enum SdkErrorCode {\n    // State errors\n    /** Transport is not connected */\n    NotConnected = 'NOT_CONNECTED',\n    /** Transport is already connected */\n    AlreadyConnected = 'ALREADY_CONNECTED',\n    /** Protocol is not initialized */\n    NotInitialized = 'NOT_INITIALIZED',\n\n    // Capability errors\n    /** Required capability is not supported by the remote side */\n    CapabilityNotSupported = 'CAPABILITY_NOT_SUPPORTED',\n\n    // Transport errors\n    /** Request timed out waiting for response */\n    RequestTimeout = 'REQUEST_TIMEOUT',\n    /** Connection was closed */\n    ConnectionClosed = 'CONNECTION_CLOSED',\n    /** Failed to send message */\n    SendFailed = 'SEND_FAILED',\n    /** Response result failed local schema validation */\n    InvalidResult = 'INVALID_RESULT',\n\n    // Transport errors\n    ClientHttpNotImplemented = 'CLIENT_HTTP_NOT_IMPLEMENTED',\n    ClientHttpAuthentication = 'CLIENT_HTTP_AUTHENTICATION',\n    ClientHttpForbidden = 'CLIENT_HTTP_FORBIDDEN',\n    ClientHttpUnexpectedContent = 'CLIENT_HTTP_UNEXPECTED_CONTENT',\n    ClientHttpFailedToOpenStream = 'CLIENT_HTTP_FAILED_TO_OPEN_STREAM',\n    ClientHttpFailedToTerminateSession = 'CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION'\n}\n\n/**\n * SDK errors are local errors that never cross the wire.\n * They are distinct from {@linkcode ProtocolError} which represents JSON-RPC protocol errors\n * that are serialized and sent as error responses.\n *\n * @example\n * ```ts source=\"./sdkErrors.examples.ts#SdkError_basicUsage\"\n * try {\n *     // Throwing an SDK error\n *     throw new SdkError(SdkErrorCode.NotConnected, 'Transport is not connected');\n * } catch (error) {\n *     // Checking error type by code\n *     if (error instanceof SdkError && error.code === SdkErrorCode.RequestTimeout) {\n *         // Handle timeout\n *     }\n * }\n * ```\n */\nexport class SdkError extends Error {\n    constructor(\n        public readonly code: SdkErrorCode,\n        message: string,\n        public readonly data?: unknown\n    ) {\n        super(message);\n        this.name = 'SdkError';\n    }\n}\n\n/**\n * Typed shape for HTTP error data carried by {@linkcode SdkHttpError}.\n */\nexport interface SdkHttpErrorData {\n    status: number;\n    statusText?: string;\n    [key: string]: unknown;\n}\n\n/**\n * An {@linkcode SdkError} subclass for HTTP transport failures.\n *\n * Thrown by the streamable HTTP transport when the server responds with a\n * non-OK status code. Narrows {@linkcode SdkError.data | data} to\n * {@linkcode SdkHttpErrorData} so consumers can inspect the HTTP status\n * without unsafe casting.\n *\n * @example\n * ```ts source=\"./sdkErrors.examples.ts#SdkHttpError_basicUsage\"\n * if (error instanceof SdkHttpError) {\n *     console.log(error.status); // number\n *     console.log(error.statusText); // string | undefined\n * }\n * ```\n */\nexport class SdkHttpError extends SdkError {\n    declare readonly data: SdkHttpErrorData;\n\n    constructor(code: SdkErrorCode, message: string, data: SdkHttpErrorData) {\n        super(code, message, data);\n        this.name = 'SdkHttpError';\n    }\n\n    get status(): number {\n        return this.data.status;\n    }\n\n    get statusText(): string | undefined {\n        return this.data.statusText;\n    }\n}\n","import * as z from 'zod/v4';\n\n/**\n * Reusable URL validation that disallows `javascript:` scheme\n */\nexport const SafeUrlSchema = z\n    .url()\n    .superRefine((val, ctx) => {\n        if (!URL.canParse(val)) {\n            ctx.addIssue({\n                code: z.ZodIssueCode.custom,\n                message: 'URL must be parseable',\n                fatal: true\n            });\n\n            return z.NEVER;\n        }\n    })\n    .refine(\n        url => {\n            const u = new URL(url);\n            return u.protocol !== 'javascript:' && u.protocol !== 'data:' && u.protocol !== 'vbscript:';\n        },\n        { message: 'URL cannot use javascript:, data:, or vbscript: scheme' }\n    );\n\n/**\n * RFC 9728 OAuth Protected Resource Metadata\n */\nexport const OAuthProtectedResourceMetadataSchema = z.looseObject({\n    resource: z.string().url(),\n    authorization_servers: z.array(SafeUrlSchema).optional(),\n    jwks_uri: z.string().url().optional(),\n    scopes_supported: z.array(z.string()).optional(),\n    bearer_methods_supported: z.array(z.string()).optional(),\n    resource_signing_alg_values_supported: z.array(z.string()).optional(),\n    resource_name: z.string().optional(),\n    resource_documentation: z.string().optional(),\n    resource_policy_uri: z.string().url().optional(),\n    resource_tos_uri: z.string().url().optional(),\n    tls_client_certificate_bound_access_tokens: z.boolean().optional(),\n    authorization_details_types_supported: z.array(z.string()).optional(),\n    dpop_signing_alg_values_supported: z.array(z.string()).optional(),\n    dpop_bound_access_tokens_required: z.boolean().optional()\n});\n\n/**\n * RFC 8414 OAuth 2.0 Authorization Server Metadata\n */\nexport const OAuthMetadataSchema = z.looseObject({\n    issuer: z.string(),\n    authorization_endpoint: SafeUrlSchema,\n    token_endpoint: SafeUrlSchema,\n    registration_endpoint: SafeUrlSchema.optional(),\n    scopes_supported: z.array(z.string()).optional(),\n    response_types_supported: z.array(z.string()),\n    response_modes_supported: z.array(z.string()).optional(),\n    grant_types_supported: z.array(z.string()).optional(),\n    token_endpoint_auth_methods_supported: z.array(z.string()).optional(),\n    token_endpoint_auth_signing_alg_values_supported: z.array(z.string()).optional(),\n    service_documentation: SafeUrlSchema.optional(),\n    revocation_endpoint: SafeUrlSchema.optional(),\n    revocation_endpoint_auth_methods_supported: z.array(z.string()).optional(),\n    revocation_endpoint_auth_signing_alg_values_supported: z.array(z.string()).optional(),\n    introspection_endpoint: z.string().optional(),\n    introspection_endpoint_auth_methods_supported: z.array(z.string()).optional(),\n    introspection_endpoint_auth_signing_alg_values_supported: z.array(z.string()).optional(),\n    code_challenge_methods_supported: z.array(z.string()).optional(),\n    client_id_metadata_document_supported: z.boolean().optional()\n});\n\n/**\n * OpenID Connect Discovery 1.0 Provider Metadata\n *\n * @see https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata\n */\nexport const OpenIdProviderMetadataSchema = z.looseObject({\n    issuer: z.string(),\n    authorization_endpoint: SafeUrlSchema,\n    token_endpoint: SafeUrlSchema,\n    userinfo_endpoint: SafeUrlSchema.optional(),\n    jwks_uri: SafeUrlSchema,\n    registration_endpoint: SafeUrlSchema.optional(),\n    scopes_supported: z.array(z.string()).optional(),\n    response_types_supported: z.array(z.string()),\n    response_modes_supported: z.array(z.string()).optional(),\n    grant_types_supported: z.array(z.string()).optional(),\n    acr_values_supported: z.array(z.string()).optional(),\n    subject_types_supported: z.array(z.string()),\n    id_token_signing_alg_values_supported: z.array(z.string()),\n    id_token_encryption_alg_values_supported: z.array(z.string()).optional(),\n    id_token_encryption_enc_values_supported: z.array(z.string()).optional(),\n    userinfo_signing_alg_values_supported: z.array(z.string()).optional(),\n    userinfo_encryption_alg_values_supported: z.array(z.string()).optional(),\n    userinfo_encryption_enc_values_supported: z.array(z.string()).optional(),\n    request_object_signing_alg_values_supported: z.array(z.string()).optional(),\n    request_object_encryption_alg_values_supported: z.array(z.string()).optional(),\n    request_object_encryption_enc_values_supported: z.array(z.string()).optional(),\n    token_endpoint_auth_methods_supported: z.array(z.string()).optional(),\n    token_endpoint_auth_signing_alg_values_supported: z.array(z.string()).optional(),\n    display_values_supported: z.array(z.string()).optional(),\n    claim_types_supported: z.array(z.string()).optional(),\n    claims_supported: z.array(z.string()).optional(),\n    service_documentation: z.string().optional(),\n    claims_locales_supported: z.array(z.string()).optional(),\n    ui_locales_supported: z.array(z.string()).optional(),\n    claims_parameter_supported: z.boolean().optional(),\n    request_parameter_supported: z.boolean().optional(),\n    request_uri_parameter_supported: z.boolean().optional(),\n    require_request_uri_registration: z.boolean().optional(),\n    op_policy_uri: SafeUrlSchema.optional(),\n    op_tos_uri: SafeUrlSchema.optional(),\n    client_id_metadata_document_supported: z.boolean().optional()\n});\n\n/**\n * OpenID Connect Discovery metadata that may include OAuth 2.0 fields\n * This schema represents the real-world scenario where OIDC providers\n * return a mix of OpenID Connect and OAuth 2.0 metadata fields\n */\nexport const OpenIdProviderDiscoveryMetadataSchema = z.object({\n    ...OpenIdProviderMetadataSchema.shape,\n    ...OAuthMetadataSchema.pick({\n        code_challenge_methods_supported: true\n    }).shape\n});\n\n/**\n * OAuth 2.1 token response\n */\nexport const OAuthTokensSchema = z\n    .object({\n        access_token: z.string(),\n        id_token: z.string().optional(), // Optional for OAuth 2.1, but necessary in OpenID Connect\n        token_type: z.string(),\n        expires_in: z.coerce.number().optional(),\n        scope: z.string().optional(),\n        refresh_token: z.string().optional()\n    })\n    .strip();\n\n/**\n * RFC 8693 §2.2.1 Token Exchange response for ID-JAG tokens.\n *\n * `token_type` is intentionally optional: per RFC 8693 §2.2.1 it is informational when\n * the issued token is not an access token, and per RFC 6749 §5.1 it is case-insensitive,\n * so strict checking rejects conformant IdPs.\n */\nexport const IdJagTokenExchangeResponseSchema = z\n    .object({\n        issued_token_type: z.literal('urn:ietf:params:oauth:token-type:id-jag'),\n        access_token: z.string(),\n        token_type: z.string().optional(),\n        expires_in: z.number().optional(),\n        scope: z.string().optional()\n    })\n    .strip();\n\nexport type IdJagTokenExchangeResponse = z.infer<typeof IdJagTokenExchangeResponseSchema>;\n\n/**\n * OAuth 2.1 error response\n */\nexport const OAuthErrorResponseSchema = z.object({\n    error: z.string(),\n    error_description: z.string().optional(),\n    error_uri: z.string().optional()\n});\n\n/**\n * Optional version of {@linkcode SafeUrlSchema} that allows empty string for backward compatibility on `tos_uri` and `logo_uri`\n */\n// eslint-disable-next-line unicorn/no-useless-undefined\nexport const OptionalSafeUrlSchema = SafeUrlSchema.optional().or(z.literal('').transform(() => undefined));\n\n/**\n * RFC 7591 OAuth 2.0 Dynamic Client Registration metadata\n */\nexport const OAuthClientMetadataSchema = z\n    .object({\n        redirect_uris: z.array(SafeUrlSchema),\n        token_endpoint_auth_method: z.string().optional(),\n        grant_types: z.array(z.string()).optional(),\n        response_types: z.array(z.string()).optional(),\n        client_name: z.string().optional(),\n        client_uri: SafeUrlSchema.optional(),\n        logo_uri: OptionalSafeUrlSchema,\n        scope: z.string().optional(),\n        contacts: z.array(z.string()).optional(),\n        tos_uri: OptionalSafeUrlSchema,\n        policy_uri: z.string().optional(),\n        jwks_uri: SafeUrlSchema.optional(),\n        jwks: z.any().optional(),\n        software_id: z.string().optional(),\n        software_version: z.string().optional(),\n        software_statement: z.string().optional()\n    })\n    .strip();\n\n/**\n * RFC 7591 OAuth 2.0 Dynamic Client Registration client information\n */\nexport const OAuthClientInformationSchema = z\n    .object({\n        client_id: z.string(),\n        client_secret: z.string().optional(),\n        client_id_issued_at: z.number().optional(),\n        client_secret_expires_at: z.number().optional()\n    })\n    .strip();\n\n/**\n * RFC 7591 OAuth 2.0 Dynamic Client Registration full response (client information plus metadata)\n */\nexport const OAuthClientInformationFullSchema = OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);\n\n/**\n * RFC 7591 OAuth 2.0 Dynamic Client Registration error response\n */\nexport const OAuthClientRegistrationErrorSchema = z\n    .object({\n        error: z.string(),\n        error_description: z.string().optional()\n    })\n    .strip();\n\n/**\n * RFC 7009 OAuth 2.0 Token Revocation request\n */\nexport const OAuthTokenRevocationRequestSchema = z\n    .object({\n        token: z.string(),\n        token_type_hint: z.string().optional()\n    })\n    .strip();\n\nexport type OAuthMetadata = z.infer<typeof OAuthMetadataSchema>;\nexport type OpenIdProviderMetadata = z.infer<typeof OpenIdProviderMetadataSchema>;\nexport type OpenIdProviderDiscoveryMetadata = z.infer<typeof OpenIdProviderDiscoveryMetadataSchema>;\n\nexport type OAuthTokens = z.infer<typeof OAuthTokensSchema>;\nexport type OAuthErrorResponse = z.infer<typeof OAuthErrorResponseSchema>;\nexport type OAuthClientMetadata = z.infer<typeof OAuthClientMetadataSchema>;\nexport type OAuthClientInformation = z.infer<typeof OAuthClientInformationSchema>;\nexport type OAuthClientInformationFull = z.infer<typeof OAuthClientInformationFullSchema>;\nexport type OAuthClientInformationMixed = OAuthClientInformation | OAuthClientInformationFull;\nexport type OAuthClientRegistrationError = z.infer<typeof OAuthClientRegistrationErrorSchema>;\nexport type OAuthTokenRevocationRequest = z.infer<typeof OAuthTokenRevocationRequestSchema>;\nexport type OAuthProtectedResourceMetadata = z.infer<typeof OAuthProtectedResourceMetadataSchema>;\n\n// Unified type for authorization server metadata\nexport type AuthorizationServerMetadata = OAuthMetadata | OpenIdProviderDiscoveryMetadata;\n","/**\n * Utilities for handling OAuth resource URIs.\n */\n\n/**\n * Converts a server URL to a resource URL by removing the fragment.\n * {@link https://datatracker.ietf.org/doc/html/rfc8707#section-2 | RFC 8707 section 2}\n * states that resource URIs \"MUST NOT include a fragment component\".\n * Keeps everything else unchanged (scheme, domain, port, path, query).\n */\nexport function resourceUrlFromServerUrl(url: URL | string): URL {\n    const resourceURL = typeof url === 'string' ? new URL(url) : new URL(url.href);\n    resourceURL.hash = ''; // Remove fragment\n    return resourceURL;\n}\n\n/**\n * Checks if a requested resource URL matches a configured resource URL.\n * A requested resource matches if it has the same scheme, domain, port,\n * and its path starts with the configured resource's path.\n *\n * @param options - The options object\n * @param options.requestedResource - The resource URL being requested\n * @param options.configuredResource - The resource URL that has been configured\n * @returns true if the requested resource matches the configured resource, false otherwise\n */\nexport function checkResourceAllowed({\n    requestedResource,\n    configuredResource\n}: {\n    requestedResource: URL | string;\n    configuredResource: URL | string;\n}): boolean {\n    const requested = typeof requestedResource === 'string' ? new URL(requestedResource) : new URL(requestedResource.href);\n    const configured = typeof configuredResource === 'string' ? new URL(configuredResource) : new URL(configuredResource.href);\n\n    // Compare the origin (scheme, domain, and port)\n    if (requested.origin !== configured.origin) {\n        return false;\n    }\n\n    // Handle cases like requested=/foo and configured=/foo/\n    if (requested.pathname.length < configured.pathname.length) {\n        return false;\n    }\n\n    // Check if the requested path starts with the configured path\n    // Ensure both paths end with / for proper comparison\n    // This ensures that if we have paths like \"/api\" and \"/api/users\",\n    // we properly detect that \"/api/users\" is a subpath of \"/api\"\n    // By adding a trailing slash if missing, we avoid false positives\n    // where paths like \"/api123\" would incorrectly match \"/api\"\n    const requestedPath = requested.pathname.endsWith('/') ? requested.pathname : requested.pathname + '/';\n    const configuredPath = configured.pathname.endsWith('/') ? configured.pathname : configured.pathname + '/';\n\n    return requestedPath.startsWith(configuredPath);\n}\n","import type { BaseMetadata } from '../types/index';\n\n/**\n * Utilities for working with {@linkcode BaseMetadata} objects.\n */\n\n/**\n * Gets the display name for an object with {@linkcode BaseMetadata}.\n * For tools, the precedence is: `title` → {@linkcode index.ToolAnnotations | annotations}.`title` → `name`\n * For other objects: `title` → `name`\n * This implements the spec requirement: \"if no title is provided, name should be used for display purposes\"\n */\nexport function getDisplayName(metadata: BaseMetadata | (BaseMetadata & { annotations?: { title?: string } })): string {\n    // First check for title (not undefined and not empty string)\n    if (metadata.title !== undefined && metadata.title !== '') {\n        return metadata.title;\n    }\n\n    // Then check for annotations.title (only present in Tool objects)\n    if ('annotations' in metadata && metadata.annotations?.title) {\n        return metadata.annotations.title;\n    }\n\n    // Finally fall back to name\n    return metadata.name;\n}\n","export const LATEST_PROTOCOL_VERSION = '2025-11-25';\nexport const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = '2025-03-26';\nexport const SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, '2025-06-18', '2025-03-26', '2024-11-05', '2024-10-07'];\n\nexport const RELATED_TASK_META_KEY = 'io.modelcontextprotocol/related-task';\n\n/* Reserved `_meta` keys for the per-request envelope (protocol revision 2026-07-28) */\n\n/**\n * `_meta` key carrying the MCP protocol version governing a request.\n *\n * For the HTTP transport, the value must match the `MCP-Protocol-Version` header.\n */\nexport const PROTOCOL_VERSION_META_KEY = 'io.modelcontextprotocol/protocolVersion';\n\n/**\n * `_meta` key identifying the client software making a request.\n */\nexport const CLIENT_INFO_META_KEY = 'io.modelcontextprotocol/clientInfo';\n\n/**\n * `_meta` key carrying the client's capabilities for a request.\n *\n * Capabilities are declared per request rather than once at initialization;\n * servers must not infer capabilities from prior requests.\n */\nexport const CLIENT_CAPABILITIES_META_KEY = 'io.modelcontextprotocol/clientCapabilities';\n\n/**\n * `_meta` key carrying the desired log level for a request.\n *\n * When absent, the server must not send `notifications/message` notifications\n * for the request.\n *\n * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains\n * in the specification for at least twelve months.\n */\nexport const LOG_LEVEL_META_KEY = 'io.modelcontextprotocol/logLevel';\n\n/*\n * Reserved `_meta` keys for distributed trace context propagation (SEP-414).\n *\n * These unprefixed keys are reserved by the MCP specification as an explicit\n * exception to the `_meta` key prefix rule. The SDK does not interpret them;\n * they pass through `_meta` untouched for OpenTelemetry-style propagation.\n */\n\n/**\n * `_meta` key carrying W3C Trace Context for distributed tracing (SEP-414).\n *\n * When present, the value MUST follow the W3C `traceparent` header format,\n * e.g. `00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01`.\n *\n * @see https://www.w3.org/TR/trace-context/#traceparent-header\n */\nexport const TRACEPARENT_META_KEY = 'traceparent';\n\n/**\n * `_meta` key carrying vendor-specific trace state for distributed tracing (SEP-414).\n *\n * When present, the value MUST follow the W3C `tracestate` header format,\n * e.g. `vendor1=value1,vendor2=value2`.\n *\n * @see https://www.w3.org/TR/trace-context/#tracestate-header\n */\nexport const TRACESTATE_META_KEY = 'tracestate';\n\n/**\n * `_meta` key carrying cross-cutting propagation values for distributed tracing (SEP-414).\n *\n * When present, the value MUST follow the W3C Baggage header format,\n * e.g. `userId=alice,serverRegion=us-east-1`.\n *\n * @see https://www.w3.org/TR/baggage/\n */\nexport const BAGGAGE_META_KEY = 'baggage';\n\n/* JSON-RPC types */\nexport const JSONRPC_VERSION = '2.0';\n\n/* Standard JSON-RPC error code constants */\nexport const PARSE_ERROR = -32_700;\nexport const INVALID_REQUEST = -32_600;\nexport const METHOD_NOT_FOUND = -32_601;\nexport const INVALID_PARAMS = -32_602;\nexport const INTERNAL_ERROR = -32_603;\n","/**\n * Error codes for protocol errors that cross the wire as JSON-RPC error responses.\n * These follow the JSON-RPC specification and MCP-specific extensions.\n */\nexport enum ProtocolErrorCode {\n    // Standard JSON-RPC error codes\n    ParseError = -32_700,\n    InvalidRequest = -32_600,\n    MethodNotFound = -32_601,\n    InvalidParams = -32_602,\n    InternalError = -32_603,\n\n    // MCP-specific error codes\n    ResourceNotFound = -32_002,\n    /**\n     * Processing the request requires a capability the client did not declare\n     * in the request's `clientCapabilities` (protocol revision 2026-07-28).\n     */\n    MissingRequiredClientCapability = -32_003,\n    /**\n     * The request's protocol version is unknown to the server or unsupported\n     * by it (protocol revision 2026-07-28).\n     */\n    UnsupportedProtocolVersion = -32_004,\n    UrlElicitationRequired = -32_042\n}\n","import { ProtocolErrorCode } from './enums';\nimport type { ElicitRequestURLParams, UnsupportedProtocolVersionErrorData } from './types';\n\n/**\n * Protocol errors are JSON-RPC errors that cross the wire as error responses.\n * They use numeric error codes from the {@linkcode ProtocolErrorCode} enum.\n */\nexport class ProtocolError extends Error {\n    constructor(\n        public readonly code: number,\n        message: string,\n        public readonly data?: unknown\n    ) {\n        super(message);\n        this.name = 'ProtocolError';\n    }\n\n    /**\n     * Factory method to create the appropriate error type based on the error code and data\n     */\n    static fromError(code: number, message: string, data?: unknown): ProtocolError {\n        // Check for specific error types\n        if (code === ProtocolErrorCode.UrlElicitationRequired && data) {\n            const errorData = data as { elicitations?: unknown[] };\n            if (errorData.elicitations) {\n                return new UrlElicitationRequiredError(errorData.elicitations as ElicitRequestURLParams[], message);\n            }\n        }\n\n        if (code === ProtocolErrorCode.UnsupportedProtocolVersion && data) {\n            const errorData = data as Partial<UnsupportedProtocolVersionErrorData>;\n            if (Array.isArray(errorData.supported) && typeof errorData.requested === 'string') {\n                return new UnsupportedProtocolVersionError({ supported: errorData.supported, requested: errorData.requested }, message);\n            }\n        }\n\n        // Default to generic ProtocolError\n        return new ProtocolError(code, message, data);\n    }\n}\n\n/**\n * Specialized error type when a tool requires a URL mode elicitation.\n * This makes it nicer for the client to handle since there is specific data to work with instead of just a code to check against.\n */\nexport class UrlElicitationRequiredError extends ProtocolError {\n    constructor(elicitations: ElicitRequestURLParams[], message: string = `URL elicitation${elicitations.length > 1 ? 's' : ''} required`) {\n        super(ProtocolErrorCode.UrlElicitationRequired, message, {\n            elicitations: elicitations\n        });\n    }\n\n    get elicitations(): ElicitRequestURLParams[] {\n        return (this.data as { elicitations: ElicitRequestURLParams[] })?.elicitations ?? [];\n    }\n}\n\n/**\n * Error type for the `-32004` UnsupportedProtocolVersion protocol error (protocol\n * revision 2026-07-28): the request's protocol version is unknown to the server or\n * unsupported by it.\n *\n * The error data lists the protocol versions the receiver supports (`supported`),\n * so the sender can choose a mutually supported version and retry, and echoes the\n * version that was requested (`requested`).\n */\nexport class UnsupportedProtocolVersionError extends ProtocolError {\n    constructor(data: UnsupportedProtocolVersionErrorData, message: string = `Unsupported protocol version: ${data.requested}`) {\n        super(ProtocolErrorCode.UnsupportedProtocolVersion, message, data);\n    }\n\n    /**\n     * Protocol versions the receiver supports.\n     */\n    get supported(): string[] {\n        return (this.data as UnsupportedProtocolVersionErrorData).supported;\n    }\n\n    /**\n     * The protocol version that was requested.\n     */\n    get requested(): string {\n        return (this.data as UnsupportedProtocolVersionErrorData).requested;\n    }\n}\n","import * as z from 'zod/v4';\n\nimport {\n    CLIENT_CAPABILITIES_META_KEY,\n    CLIENT_INFO_META_KEY,\n    JSONRPC_VERSION,\n    LOG_LEVEL_META_KEY,\n    PROTOCOL_VERSION_META_KEY,\n    RELATED_TASK_META_KEY\n} from './constants';\nimport type {\n    JSONArray,\n    JSONObject,\n    JSONValue,\n    NotificationMethod,\n    NotificationTypeMap,\n    RequestMethod,\n    RequestTypeMap,\n    ResultTypeMap\n} from './types';\n\nexport const JSONValueSchema: z.ZodType<JSONValue, JSONValue> = z.lazy(() =>\n    z.union([z.string(), z.number(), z.boolean(), z.null(), z.record(z.string(), JSONValueSchema), z.array(JSONValueSchema)])\n);\nexport const JSONObjectSchema: z.ZodType<JSONObject, JSONObject> = z.record(z.string(), JSONValueSchema);\nexport const JSONArraySchema: z.ZodType<JSONArray, JSONArray> = z.array(JSONValueSchema);\n/**\n * A progress token, used to associate progress notifications with the original request.\n */\nexport const ProgressTokenSchema = z.union([z.string(), z.number().int()]);\n\n/**\n * An opaque token used to represent a cursor for pagination.\n */\nexport const CursorSchema = z.string();\n\n/**\n * Task creation parameters, used to ask that the server create a task to represent a request.\n */\nexport const TaskCreationParamsSchema = z.looseObject({\n    /**\n     * Requested duration in milliseconds to retain task from creation.\n     */\n    ttl: z.number().optional(),\n\n    /**\n     * Time in milliseconds to wait between task status requests.\n     */\n    pollInterval: z.number().optional()\n});\n\nexport const TaskMetadataSchema = z.object({\n    ttl: z.number().optional()\n});\n\n/**\n * Metadata for associating messages with a task.\n * Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`.\n */\nexport const RelatedTaskMetadataSchema = z.object({\n    taskId: z.string()\n});\n\nexport const RequestMetaSchema = z.looseObject({\n    /**\n     * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\n     */\n    progressToken: ProgressTokenSchema.optional(),\n    /**\n     * If specified, this request is related to the provided task.\n     */\n    [RELATED_TASK_META_KEY]: RelatedTaskMetadataSchema.optional()\n});\n\n/**\n * Common params for any request.\n */\nexport const BaseRequestParamsSchema = z.object({\n    /**\n     * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage.\n     */\n    _meta: RequestMetaSchema.optional()\n});\n\n/**\n * Common params for any task-augmented request.\n */\nexport const TaskAugmentedRequestParamsSchema = BaseRequestParamsSchema.extend({\n    /**\n     * If specified, the caller is requesting task-augmented execution for this request.\n     * The request will return a `CreateTaskResult` immediately, and the actual result can be\n     * retrieved later via `tasks/result`.\n     *\n     * Task augmentation is subject to capability negotiation - receivers MUST declare support\n     * for task augmentation of specific request types in their capabilities.\n     */\n    task: TaskMetadataSchema.optional()\n});\n\nexport const RequestSchema = z.object({\n    method: z.string(),\n    params: BaseRequestParamsSchema.loose().optional()\n});\n\nexport const NotificationsParamsSchema = z.object({\n    /**\n     * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n     * for notes on `_meta` usage.\n     */\n    _meta: RequestMetaSchema.optional()\n});\n\nexport const NotificationSchema = z.object({\n    method: z.string(),\n    params: NotificationsParamsSchema.loose().optional()\n});\n\nexport const ResultSchema = z.looseObject({\n    /**\n     * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n     * for notes on `_meta` usage.\n     */\n    _meta: RequestMetaSchema.optional(),\n    /**\n     * Indicates the type of the result, allowing the receiver to determine how to\n     * parse the result object. Servers implementing protocol revision 2026-07-28 or\n     * later always include this field; results from earlier revisions omit it, and\n     * an absent value must be treated as `\"complete\"`.\n     */\n    resultType: z.string().optional()\n});\n\n/**\n * A uniquely identifying ID for a request in JSON-RPC.\n */\nexport const RequestIdSchema = z.union([z.string(), z.number().int()]);\n\n/**\n * A request that expects a response.\n */\nexport const JSONRPCRequestSchema = z\n    .object({\n        jsonrpc: z.literal(JSONRPC_VERSION),\n        id: RequestIdSchema,\n        ...RequestSchema.shape\n    })\n    .strict();\n\n/**\n * A notification which does not expect a response.\n */\nexport const JSONRPCNotificationSchema = z\n    .object({\n        jsonrpc: z.literal(JSONRPC_VERSION),\n        ...NotificationSchema.shape\n    })\n    .strict();\n\n/**\n * A successful (non-error) response to a request.\n */\nexport const JSONRPCResultResponseSchema = z\n    .object({\n        jsonrpc: z.literal(JSONRPC_VERSION),\n        id: RequestIdSchema,\n        result: ResultSchema\n    })\n    .strict();\n\n/**\n * A response to a request that indicates an error occurred.\n */\nexport const JSONRPCErrorResponseSchema = z\n    .object({\n        jsonrpc: z.literal(JSONRPC_VERSION),\n        id: RequestIdSchema.optional(),\n        error: z.object({\n            /**\n             * The error type that occurred.\n             */\n            code: z.number().int(),\n            /**\n             * A short description of the error. The message SHOULD be limited to a concise single sentence.\n             */\n            message: z.string(),\n            /**\n             * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).\n             */\n            data: z.unknown().optional()\n        })\n    })\n    .strict();\n\nexport const JSONRPCMessageSchema = z.union([\n    JSONRPCRequestSchema,\n    JSONRPCNotificationSchema,\n    JSONRPCResultResponseSchema,\n    JSONRPCErrorResponseSchema\n]);\n\nexport const JSONRPCResponseSchema = z.union([JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema]);\n\n/* Empty result */\n/**\n * A response that indicates success but carries no data.\n */\nexport const EmptyResultSchema = ResultSchema.strict();\n\nexport const CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({\n    /**\n     * The ID of the request to cancel.\n     *\n     * This MUST correspond to the ID of a request previously issued in the same direction.\n     */\n    requestId: RequestIdSchema.optional(),\n    /**\n     * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.\n     */\n    reason: z.string().optional()\n});\n/* Cancellation */\n/**\n * This notification can be sent by either side to indicate that it is cancelling a previously-issued request.\n *\n * The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.\n *\n * This notification indicates that the result will be unused, so any associated processing SHOULD cease.\n *\n * A client MUST NOT attempt to cancel its {@linkcode InitializeRequest | initialize} request.\n */\nexport const CancelledNotificationSchema = NotificationSchema.extend({\n    method: z.literal('notifications/cancelled'),\n    params: CancelledNotificationParamsSchema\n});\n\n/* Base Metadata */\n/**\n * Icon schema for use in {@link Tool | tools}, {@link Prompt | prompts}, {@link Resource | resources}, and {@link Implementation | implementations}.\n */\nexport const IconSchema = z.object({\n    /**\n     * URL or data URI for the icon.\n     */\n    src: z.string(),\n    /**\n     * Optional MIME type for the icon.\n     */\n    mimeType: z.string().optional(),\n    /**\n     * Optional array of strings that specify sizes at which the icon can be used.\n     * Each string should be in WxH format (e.g., `\"48x48\"`, `\"96x96\"`) or `\"any\"` for scalable formats like SVG.\n     *\n     * If not provided, the client should assume that the icon can be used at any size.\n     */\n    sizes: z.array(z.string()).optional(),\n    /**\n     * Optional specifier for the theme this icon is designed for. `light` indicates\n     * the icon is designed to be used with a light background, and `dark` indicates\n     * the icon is designed to be used with a dark background.\n     *\n     * If not provided, the client should assume the icon can be used with any theme.\n     */\n    theme: z.enum(['light', 'dark']).optional()\n});\n\n/**\n * Base schema to add `icons` property.\n *\n */\nexport const IconsSchema = z.object({\n    /**\n     * Optional set of sized icons that the client can display in a user interface.\n     *\n     * Clients that support rendering icons MUST support at least the following MIME types:\n     * - `image/png` - PNG images (safe, universal compatibility)\n     * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility)\n     *\n     * Clients that support rendering icons SHOULD also support:\n     * - `image/svg+xml` - SVG images (scalable but requires security precautions)\n     * - `image/webp` - WebP images (modern, efficient format)\n     */\n    icons: z.array(IconSchema).optional()\n});\n\n/**\n * Base metadata interface for common properties across {@link Resource | resources}, {@link Tool | tools}, {@link Prompt | prompts}, and {@link Implementation | implementations}.\n */\nexport const BaseMetadataSchema = z.object({\n    /** Intended for programmatic or logical use, but used as a display name in past specs or fallback */\n    name: z.string(),\n    /**\n     * Intended for UI and end-user contexts — optimized to be human-readable and easily understood,\n     * even by those unfamiliar with domain-specific terminology.\n     *\n     * If not provided, the `name` should be used for display (except for `Tool`,\n     * where `annotations.title` should be given precedence over using `name`,\n     * if present).\n     */\n    title: z.string().optional()\n});\n\n/* Initialization */\n/**\n * Describes the name and version of an MCP implementation.\n */\nexport const ImplementationSchema = BaseMetadataSchema.extend({\n    ...BaseMetadataSchema.shape,\n    ...IconsSchema.shape,\n    version: z.string(),\n    /**\n     * An optional URL of the website for this implementation.\n     */\n    websiteUrl: z.string().optional(),\n\n    /**\n     * An optional human-readable description of what this implementation does.\n     *\n     * This can be used by clients or servers to provide context about their purpose\n     * and capabilities. For example, a server might describe the types of resources\n     * or tools it provides, while a client might describe its intended use case.\n     */\n    description: z.string().optional()\n});\n\nconst FormElicitationCapabilitySchema = z.intersection(\n    z.object({\n        applyDefaults: z.boolean().optional()\n    }),\n    JSONObjectSchema\n);\n\nconst ElicitationCapabilitySchema = z.preprocess(\n    value => {\n        if (value && typeof value === 'object' && !Array.isArray(value) && Object.keys(value as Record<string, unknown>).length === 0) {\n            return { form: {} };\n        }\n        return value;\n    },\n    z.intersection(\n        z.object({\n            form: FormElicitationCapabilitySchema.optional(),\n            url: JSONObjectSchema.optional()\n        }),\n        JSONObjectSchema.optional()\n    )\n);\n\n/**\n * Task capabilities for clients, indicating which request types support task creation.\n */\nexport const ClientTasksCapabilitySchema = z.looseObject({\n    /**\n     * Present if the client supports listing tasks.\n     */\n    list: JSONObjectSchema.optional(),\n    /**\n     * Present if the client supports cancelling tasks.\n     */\n    cancel: JSONObjectSchema.optional(),\n    /**\n     * Capabilities for task creation on specific request types.\n     */\n    requests: z\n        .looseObject({\n            /**\n             * Task support for sampling requests.\n             */\n            sampling: z\n                .looseObject({\n                    createMessage: JSONObjectSchema.optional()\n                })\n                .optional(),\n            /**\n             * Task support for elicitation requests.\n             */\n            elicitation: z\n                .looseObject({\n                    create: JSONObjectSchema.optional()\n                })\n                .optional()\n        })\n        .optional()\n});\n\n/**\n * Task capabilities for servers, indicating which request types support task creation.\n */\nexport const ServerTasksCapabilitySchema = z.looseObject({\n    /**\n     * Present if the server supports listing tasks.\n     */\n    list: JSONObjectSchema.optional(),\n    /**\n     * Present if the server supports cancelling tasks.\n     */\n    cancel: JSONObjectSchema.optional(),\n    /**\n     * Capabilities for task creation on specific request types.\n     */\n    requests: z\n        .looseObject({\n            /**\n             * Task support for tool requests.\n             */\n            tools: z\n                .looseObject({\n                    call: JSONObjectSchema.optional()\n                })\n                .optional()\n        })\n        .optional()\n});\n\n/**\n * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.\n */\nexport const ClientCapabilitiesSchema = z.object({\n    /**\n     * Experimental, non-standard capabilities that the client supports.\n     */\n    experimental: z.record(z.string(), JSONObjectSchema).optional(),\n    /**\n     * Present if the client supports sampling from an LLM.\n     *\n     * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains\n     * in the specification for at least twelve months. Migrate to calling LLM\n     * provider APIs directly.\n     */\n    sampling: z\n        .object({\n            /**\n             * Present if the client supports context inclusion via `includeContext` parameter.\n             * If not declared, servers SHOULD only use `includeContext: \"none\"` (or omit it).\n             */\n            context: JSONObjectSchema.optional(),\n            /**\n             * Present if the client supports tool use via `tools` and `toolChoice` parameters.\n             */\n            tools: JSONObjectSchema.optional()\n        })\n        .optional(),\n    /**\n     * Present if the client supports eliciting user input.\n     */\n    elicitation: ElicitationCapabilitySchema.optional(),\n    /**\n     * Present if the client supports listing roots.\n     *\n     * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains\n     * in the specification for at least twelve months. Migrate to passing paths via\n     * tool parameters, resource URIs, or configuration.\n     */\n    roots: z\n        .object({\n            /**\n             * Whether the client supports issuing notifications for changes to the roots list.\n             */\n            listChanged: z.boolean().optional()\n        })\n        .optional(),\n    /**\n     * Present if the client supports task creation.\n     */\n    tasks: ClientTasksCapabilitySchema.optional(),\n    /**\n     * Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).\n     */\n    extensions: z.record(z.string(), JSONObjectSchema).optional()\n});\n\nexport const InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({\n    /**\n     * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.\n     */\n    protocolVersion: z.string(),\n    capabilities: ClientCapabilitiesSchema,\n    clientInfo: ImplementationSchema\n});\n/**\n * This request is sent from the client to the server when it first connects, asking it to begin initialization.\n */\nexport const InitializeRequestSchema = RequestSchema.extend({\n    method: z.literal('initialize'),\n    params: InitializeRequestParamsSchema\n});\n\n/**\n * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.\n */\nexport const ServerCapabilitiesSchema = z.object({\n    /**\n     * Experimental, non-standard capabilities that the server supports.\n     */\n    experimental: z.record(z.string(), JSONObjectSchema).optional(),\n    /**\n     * Present if the server supports sending log messages to the client.\n     *\n     * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains\n     * in the specification for at least twelve months. Migrate to stderr logging\n     * (STDIO servers) or OpenTelemetry.\n     */\n    logging: JSONObjectSchema.optional(),\n    /**\n     * Present if the server supports sending completions to the client.\n     */\n    completions: JSONObjectSchema.optional(),\n    /**\n     * Present if the server offers any prompt templates.\n     */\n    prompts: z\n        .object({\n            /**\n             * Whether this server supports issuing notifications for changes to the prompt list.\n             */\n            listChanged: z.boolean().optional()\n        })\n        .optional(),\n    /**\n     * Present if the server offers any resources to read.\n     */\n    resources: z\n        .object({\n            /**\n             * Whether this server supports clients subscribing to resource updates.\n             */\n            subscribe: z.boolean().optional(),\n\n            /**\n             * Whether this server supports issuing notifications for changes to the resource list.\n             */\n            listChanged: z.boolean().optional()\n        })\n        .optional(),\n    /**\n     * Present if the server offers any tools to call.\n     */\n    tools: z\n        .object({\n            /**\n             * Whether this server supports issuing notifications for changes to the tool list.\n             */\n            listChanged: z.boolean().optional()\n        })\n        .optional(),\n    /**\n     * Present if the server supports task creation.\n     */\n    tasks: ServerTasksCapabilitySchema.optional(),\n    /**\n     * Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).\n     */\n    extensions: z.record(z.string(), JSONObjectSchema).optional()\n});\n\n/**\n * After receiving an initialize request from the client, the server sends this response.\n */\nexport const InitializeResultSchema = ResultSchema.extend({\n    /**\n     * The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.\n     */\n    protocolVersion: z.string(),\n    capabilities: ServerCapabilitiesSchema,\n    serverInfo: ImplementationSchema,\n    /**\n     * Instructions describing how to use the server and its features.\n     *\n     * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a \"hint\" to the model. For example, this information MAY be added to the system prompt.\n     */\n    instructions: z.string().optional()\n});\n\n/**\n * This notification is sent from the client to the server after initialization has finished.\n */\nexport const InitializedNotificationSchema = NotificationSchema.extend({\n    method: z.literal('notifications/initialized'),\n    params: NotificationsParamsSchema.optional()\n});\n\n/* Discovery */\n/**\n * A request from the client asking the server to advertise its supported protocol\n * versions, capabilities, and other metadata (protocol revision 2026-07-28). Servers\n * MUST implement `server/discover`. Clients MAY call it but are not required to —\n * version negotiation can also happen inline via the per-request `_meta` envelope.\n */\nexport const DiscoverRequestSchema = RequestSchema.extend({\n    method: z.literal('server/discover'),\n    params: BaseRequestParamsSchema.optional()\n});\n\n/**\n * The result returned by the server for a `server/discover` request.\n */\nexport const DiscoverResultSchema = ResultSchema.extend({\n    /**\n     * MCP protocol versions this server supports. The client should choose a\n     * version from this list for use in subsequent requests.\n     */\n    supportedVersions: z.array(z.string()),\n    /**\n     * The capabilities of the server.\n     */\n    capabilities: ServerCapabilitiesSchema,\n    /**\n     * Information about the server software implementation.\n     */\n    serverInfo: ImplementationSchema,\n    /**\n     * Instructions describing how to use the server and its features.\n     *\n     * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a \"hint\" to the model. For example, this information MAY be added to the system prompt.\n     */\n    instructions: z.string().optional()\n});\n\n/* Ping */\n/**\n * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.\n */\nexport const PingRequestSchema = RequestSchema.extend({\n    method: z.literal('ping'),\n    params: BaseRequestParamsSchema.optional()\n});\n\n/* Progress notifications */\nexport const ProgressSchema = z.object({\n    /**\n     * The progress thus far. This should increase every time progress is made, even if the total is unknown.\n     */\n    progress: z.number(),\n    /**\n     * Total number of items to process (or total progress required), if known.\n     */\n    total: z.optional(z.number()),\n    /**\n     * An optional message describing the current progress.\n     */\n    message: z.optional(z.string())\n});\n\nexport const ProgressNotificationParamsSchema = z.object({\n    ...NotificationsParamsSchema.shape,\n    ...ProgressSchema.shape,\n    /**\n     * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.\n     */\n    progressToken: ProgressTokenSchema\n});\n/**\n * An out-of-band notification used to inform the receiver of a progress update for a long-running request.\n *\n * @category notifications/progress\n */\nexport const ProgressNotificationSchema = NotificationSchema.extend({\n    method: z.literal('notifications/progress'),\n    params: ProgressNotificationParamsSchema\n});\n\nexport const PaginatedRequestParamsSchema = BaseRequestParamsSchema.extend({\n    /**\n     * An opaque token representing the current pagination position.\n     * If provided, the server should return results starting after this cursor.\n     */\n    cursor: CursorSchema.optional()\n});\n\n/* Pagination */\nexport const PaginatedRequestSchema = RequestSchema.extend({\n    params: PaginatedRequestParamsSchema.optional()\n});\n\nexport const PaginatedResultSchema = ResultSchema.extend({\n    /**\n     * An opaque token representing the pagination position after the last returned result.\n     * If present, there may be more results available.\n     */\n    nextCursor: CursorSchema.optional()\n});\n\n/**\n * The status of a task.\n * */\nexport const TaskStatusSchema = z.enum(['working', 'input_required', 'completed', 'failed', 'cancelled']);\n\n/* Tasks */\n/**\n * A pollable state object associated with a request.\n */\nexport const TaskSchema = z.object({\n    taskId: z.string(),\n    status: TaskStatusSchema,\n    /**\n     * Time in milliseconds to keep task results available after completion.\n     * If `null`, the task has unlimited lifetime until manually cleaned up.\n     */\n    ttl: z.union([z.number(), z.null()]),\n    /**\n     * ISO 8601 timestamp when the task was created.\n     */\n    createdAt: z.string(),\n    /**\n     * ISO 8601 timestamp when the task was last updated.\n     */\n    lastUpdatedAt: z.string(),\n    pollInterval: z.optional(z.number()),\n    /**\n     * Optional diagnostic message for failed tasks or other status information.\n     */\n    statusMessage: z.optional(z.string())\n});\n\n/**\n * Result returned when a task is created, containing the task data wrapped in a `task` field.\n */\nexport const CreateTaskResultSchema = ResultSchema.extend({\n    task: TaskSchema\n});\n\n/**\n * Parameters for task status notification.\n */\nexport const TaskStatusNotificationParamsSchema = NotificationsParamsSchema.merge(TaskSchema);\n\n/**\n * A notification sent when a task's status changes.\n */\nexport const TaskStatusNotificationSchema = NotificationSchema.extend({\n    method: z.literal('notifications/tasks/status'),\n    params: TaskStatusNotificationParamsSchema\n});\n\n/**\n * A request to get the state of a specific task.\n */\nexport const GetTaskRequestSchema = RequestSchema.extend({\n    method: z.literal('tasks/get'),\n    params: BaseRequestParamsSchema.extend({\n        taskId: z.string()\n    })\n});\n\n/**\n * The response to a {@linkcode GetTaskRequest | tasks/get} request.\n */\nexport const GetTaskResultSchema = ResultSchema.merge(TaskSchema);\n\n/**\n * A request to get the result of a specific task.\n */\nexport const GetTaskPayloadRequestSchema = RequestSchema.extend({\n    method: z.literal('tasks/result'),\n    params: BaseRequestParamsSchema.extend({\n        taskId: z.string()\n    })\n});\n\n/**\n * The response to a `tasks/result` request.\n * The structure matches the result type of the original request.\n * For example, a {@linkcode CallToolRequest | tools/call} task would return the `CallToolResult` structure.\n *\n */\nexport const GetTaskPayloadResultSchema = ResultSchema.loose();\n\n/**\n * A request to list tasks.\n */\nexport const ListTasksRequestSchema = PaginatedRequestSchema.extend({\n    method: z.literal('tasks/list')\n});\n\n/**\n * The response to a {@linkcode ListTasksRequest | tasks/list} request.\n */\nexport const ListTasksResultSchema = PaginatedResultSchema.extend({\n    tasks: z.array(TaskSchema)\n});\n\n/**\n * A request to cancel a specific task.\n */\nexport const CancelTaskRequestSchema = RequestSchema.extend({\n    method: z.literal('tasks/cancel'),\n    params: BaseRequestParamsSchema.extend({\n        taskId: z.string()\n    })\n});\n\n/**\n * The response to a {@linkcode CancelTaskRequest | tasks/cancel} request.\n */\nexport const CancelTaskResultSchema = ResultSchema.merge(TaskSchema);\n\n/* Resources */\n/**\n * The contents of a specific resource or sub-resource.\n */\nexport const ResourceContentsSchema = z.object({\n    /**\n     * The URI of this resource.\n     */\n    uri: z.string(),\n    /**\n     * The MIME type of this resource, if known.\n     */\n    mimeType: z.optional(z.string()),\n    /**\n     * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n     * for notes on `_meta` usage.\n     */\n    _meta: z.record(z.string(), z.unknown()).optional()\n});\n\nexport const TextResourceContentsSchema = ResourceContentsSchema.extend({\n    /**\n     * The text of the item. This must only be set if the item can actually be represented as text (not binary data).\n     */\n    text: z.string()\n});\n\n/**\n * A Zod schema for validating Base64 strings that is more performant and\n * robust for very large inputs than the default regex-based check. It avoids\n * stack overflows by using the native `atob` function for validation.\n */\nconst Base64Schema = z.string().refine(\n    val => {\n        try {\n            // atob throws a DOMException if the string contains characters\n            // that are not part of the Base64 character set.\n            atob(val);\n            return true;\n        } catch {\n            return false;\n        }\n    },\n    { message: 'Invalid Base64 string' }\n);\n\nexport const BlobResourceContentsSchema = ResourceContentsSchema.extend({\n    /**\n     * A base64-encoded string representing the binary data of the item.\n     */\n    blob: Base64Schema\n});\n\n/**\n * The sender or recipient of messages and data in a conversation.\n */\nexport const RoleSchema = z.enum(['user', 'assistant']);\n\n/**\n * Optional annotations providing clients additional context about a resource.\n */\nexport const AnnotationsSchema = z.object({\n    /**\n     * Intended audience(s) for the resource.\n     */\n    audience: z.array(RoleSchema).optional(),\n\n    /**\n     * Importance hint for the resource, from 0 (least) to 1 (most).\n     */\n    priority: z.number().min(0).max(1).optional(),\n\n    /**\n     * ISO 8601 timestamp for the most recent modification.\n     */\n    lastModified: z.iso.datetime({ offset: true }).optional()\n});\n\n/**\n * A known resource that the server is capable of reading.\n */\nexport const ResourceSchema = z.object({\n    ...BaseMetadataSchema.shape,\n    ...IconsSchema.shape,\n    /**\n     * The URI of this resource.\n     */\n    uri: z.string(),\n\n    /**\n     * A description of what this resource represents.\n     *\n     * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.\n     */\n    description: z.optional(z.string()),\n\n    /**\n     * The MIME type of this resource, if known.\n     */\n    mimeType: z.optional(z.string()),\n\n    /**\n     * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.\n     *\n     * This can be used by Hosts to display file sizes and estimate context window usage.\n     */\n    size: z.optional(z.number()),\n\n    /**\n     * Optional annotations for the client.\n     */\n    annotations: AnnotationsSchema.optional(),\n\n    /**\n     * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n     * for notes on `_meta` usage.\n     */\n    _meta: z.optional(z.looseObject({}))\n});\n\n/**\n * A template description for resources available on the server.\n */\nexport const ResourceTemplateSchema = z.object({\n    ...BaseMetadataSchema.shape,\n    ...IconsSchema.shape,\n    /**\n     * A URI template (according to RFC 6570) that can be used to construct resource URIs.\n     */\n    uriTemplate: z.string(),\n\n    /**\n     * A description of what this template is for.\n     *\n     * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.\n     */\n    description: z.optional(z.string()),\n\n    /**\n     * The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.\n     */\n    mimeType: z.optional(z.string()),\n\n    /**\n     * Optional annotations for the client.\n     */\n    annotations: AnnotationsSchema.optional(),\n\n    /**\n     * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n     * for notes on `_meta` usage.\n     */\n    _meta: z.optional(z.looseObject({}))\n});\n\n/**\n * Sent from the client to request a list of resources the server has.\n */\nexport const ListResourcesRequestSchema = PaginatedRequestSchema.extend({\n    method: z.literal('resources/list')\n});\n\n/**\n * The server's response to a {@linkcode ListResourcesRequest | resources/list} request from the client.\n */\nexport const ListResourcesResultSchema = PaginatedResultSchema.extend({\n    resources: z.array(ResourceSchema)\n});\n\n/**\n * Sent from the client to request a list of resource templates the server has.\n */\nexport const ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend({\n    method: z.literal('resources/templates/list')\n});\n\n/**\n * The server's response to a {@linkcode ListResourceTemplatesRequest | resources/templates/list} request from the client.\n */\nexport const ListResourceTemplatesResultSchema = PaginatedResultSchema.extend({\n    resourceTemplates: z.array(ResourceTemplateSchema)\n});\n\nexport const ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({\n    /**\n     * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.\n     *\n     * @format uri\n     */\n    uri: z.string()\n});\n\n/**\n * Parameters for a {@linkcode ReadResourceRequest | resources/read} request.\n */\nexport const ReadResourceRequestParamsSchema = ResourceRequestParamsSchema;\n\n/**\n * Sent from the client to the server, to read a specific resource URI.\n */\nexport const ReadResourceRequestSchema = RequestSchema.extend({\n    method: z.literal('resources/read'),\n    params: ReadResourceRequestParamsSchema\n});\n\n/**\n * The server's response to a {@linkcode ReadResourceRequest | resources/read} request from the client.\n */\nexport const ReadResourceResultSchema = ResultSchema.extend({\n    contents: z.array(z.union([TextResourceContentsSchema, BlobResourceContentsSchema]))\n});\n\n/**\n * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.\n */\nexport const ResourceListChangedNotificationSchema = NotificationSchema.extend({\n    method: z.literal('notifications/resources/list_changed'),\n    params: NotificationsParamsSchema.optional()\n});\n\nexport const SubscribeRequestParamsSchema = ResourceRequestParamsSchema;\n/**\n * Sent from the client to request `resources/updated` notifications from the server whenever a particular resource changes.\n */\nexport const SubscribeRequestSchema = RequestSchema.extend({\n    method: z.literal('resources/subscribe'),\n    params: SubscribeRequestParamsSchema\n});\n\nexport const UnsubscribeRequestParamsSchema = ResourceRequestParamsSchema;\n/**\n * Sent from the client to request cancellation of {@linkcode ResourceUpdatedNotification | resources/updated} notifications from the server. This should follow a previous {@linkcode SubscribeRequest | resources/subscribe} request.\n */\nexport const UnsubscribeRequestSchema = RequestSchema.extend({\n    method: z.literal('resources/unsubscribe'),\n    params: UnsubscribeRequestParamsSchema\n});\n\n/**\n * Parameters for a {@linkcode ResourceUpdatedNotification | notifications/resources/updated} notification.\n */\nexport const ResourceUpdatedNotificationParamsSchema = NotificationsParamsSchema.extend({\n    /**\n     * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.\n     */\n    uri: z.string()\n});\n\n/**\n * A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a {@linkcode SubscribeRequest | resources/subscribe} request.\n */\nexport const ResourceUpdatedNotificationSchema = NotificationSchema.extend({\n    method: z.literal('notifications/resources/updated'),\n    params: ResourceUpdatedNotificationParamsSchema\n});\n\n/* Prompts */\n/**\n * Describes an argument that a prompt can accept.\n */\nexport const PromptArgumentSchema = z.object({\n    /**\n     * The name of the argument.\n     */\n    name: z.string(),\n    /**\n     * A human-readable description of the argument.\n     */\n    description: z.optional(z.string()),\n    /**\n     * Whether this argument must be provided.\n     */\n    required: z.optional(z.boolean())\n});\n\n/**\n * A prompt or prompt template that the server offers.\n */\nexport const PromptSchema = z.object({\n    ...BaseMetadataSchema.shape,\n    ...IconsSchema.shape,\n    /**\n     * An optional description of what this prompt provides\n     */\n    description: z.optional(z.string()),\n    /**\n     * A list of arguments to use for templating the prompt.\n     */\n    arguments: z.optional(z.array(PromptArgumentSchema)),\n    /**\n     * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n     * for notes on `_meta` usage.\n     */\n    _meta: z.optional(z.looseObject({}))\n});\n\n/**\n * Sent from the client to request a list of prompts and prompt templates the server has.\n */\nexport const ListPromptsRequestSchema = PaginatedRequestSchema.extend({\n    method: z.literal('prompts/list')\n});\n\n/**\n * The server's response to a {@linkcode ListPromptsRequest | prompts/list} request from the client.\n */\nexport const ListPromptsResultSchema = PaginatedResultSchema.extend({\n    prompts: z.array(PromptSchema)\n});\n\n/**\n * Parameters for a {@linkcode GetPromptRequest | prompts/get} request.\n */\nexport const GetPromptRequestParamsSchema = BaseRequestParamsSchema.extend({\n    /**\n     * The name of the prompt or prompt template.\n     */\n    name: z.string(),\n    /**\n     * Arguments to use for templating the prompt.\n     */\n    arguments: z.record(z.string(), z.string()).optional()\n});\n/**\n * Used by the client to get a prompt provided by the server.\n */\nexport const GetPromptRequestSchema = RequestSchema.extend({\n    method: z.literal('prompts/get'),\n    params: GetPromptRequestParamsSchema\n});\n\n/**\n * Text provided to or from an LLM.\n */\nexport const TextContentSchema = z.object({\n    type: z.literal('text'),\n    /**\n     * The text content of the message.\n     */\n    text: z.string(),\n\n    /**\n     * Optional annotations for the client.\n     */\n    annotations: AnnotationsSchema.optional(),\n\n    /**\n     * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n     * for notes on `_meta` usage.\n     */\n    _meta: z.record(z.string(), z.unknown()).optional()\n});\n\n/**\n * An image provided to or from an LLM.\n */\nexport const ImageContentSchema = z.object({\n    type: z.literal('image'),\n    /**\n     * The base64-encoded image data.\n     */\n    data: Base64Schema,\n    /**\n     * The MIME type of the image. Different providers may support different image types.\n     */\n    mimeType: z.string(),\n\n    /**\n     * Optional annotations for the client.\n     */\n    annotations: AnnotationsSchema.optional(),\n\n    /**\n     * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n     * for notes on `_meta` usage.\n     */\n    _meta: z.record(z.string(), z.unknown()).optional()\n});\n\n/**\n * Audio content provided to or from an LLM.\n */\nexport const AudioContentSchema = z.object({\n    type: z.literal('audio'),\n    /**\n     * The base64-encoded audio data.\n     */\n    data: Base64Schema,\n    /**\n     * The MIME type of the audio. Different providers may support different audio types.\n     */\n    mimeType: z.string(),\n\n    /**\n     * Optional annotations for the client.\n     */\n    annotations: AnnotationsSchema.optional(),\n\n    /**\n     * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n     * for notes on `_meta` usage.\n     */\n    _meta: z.record(z.string(), z.unknown()).optional()\n});\n\n/**\n * A tool call request from an assistant (LLM).\n * Represents the assistant's request to use a tool.\n */\nexport const ToolUseContentSchema = z.object({\n    type: z.literal('tool_use'),\n    /**\n     * The name of the tool to invoke.\n     * Must match a tool name from the request's tools array.\n     */\n    name: z.string(),\n    /**\n     * Unique identifier for this tool call.\n     * Used to correlate with `ToolResultContent` in subsequent messages.\n     */\n    id: z.string(),\n    /**\n     * Arguments to pass to the tool.\n     * Must conform to the tool's `inputSchema`.\n     */\n    input: z.record(z.string(), z.unknown()),\n    /**\n     * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n     * for notes on `_meta` usage.\n     */\n    _meta: z.record(z.string(), z.unknown()).optional()\n});\n\n/**\n * The contents of a resource, embedded into a prompt or tool call result.\n */\nexport const EmbeddedResourceSchema = z.object({\n    type: z.literal('resource'),\n    resource: z.union([TextResourceContentsSchema, BlobResourceContentsSchema]),\n    /**\n     * Optional annotations for the client.\n     */\n    annotations: AnnotationsSchema.optional(),\n    /**\n     * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n     * for notes on `_meta` usage.\n     */\n    _meta: z.record(z.string(), z.unknown()).optional()\n});\n\n/**\n * A resource that the server is capable of reading, included in a prompt or tool call result.\n *\n * Note: resource links returned by tools are not guaranteed to appear in the results of {@linkcode ListResourcesRequest | resources/list} requests.\n */\nexport const ResourceLinkSchema = ResourceSchema.extend({\n    type: z.literal('resource_link')\n});\n\n/**\n * A content block that can be used in prompts and tool results.\n */\nexport const ContentBlockSchema = z.union([\n    TextContentSchema,\n    ImageContentSchema,\n    AudioContentSchema,\n    ResourceLinkSchema,\n    EmbeddedResourceSchema\n]);\n\n/**\n * Describes a message returned as part of a prompt.\n */\nexport const PromptMessageSchema = z.object({\n    role: RoleSchema,\n    content: ContentBlockSchema\n});\n\n/**\n * The server's response to a {@linkcode GetPromptRequest | prompts/get} request from the client.\n */\nexport const GetPromptResultSchema = ResultSchema.extend({\n    /**\n     * An optional description for the prompt.\n     */\n    description: z.string().optional(),\n    messages: z.array(PromptMessageSchema)\n});\n\n/**\n * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.\n */\nexport const PromptListChangedNotificationSchema = NotificationSchema.extend({\n    method: z.literal('notifications/prompts/list_changed'),\n    params: NotificationsParamsSchema.optional()\n});\n\n/* Tools */\n/**\n * Additional properties describing a `Tool` to clients.\n *\n * NOTE: all properties in {@linkcode ToolAnnotations} are **hints**.\n * They are not guaranteed to provide a faithful description of\n * tool behavior (including descriptive properties like `title`).\n *\n * Clients should never make tool use decisions based on `ToolAnnotations`\n * received from untrusted servers.\n */\nexport const ToolAnnotationsSchema = z.object({\n    /**\n     * A human-readable title for the tool.\n     */\n    title: z.string().optional(),\n\n    /**\n     * If `true`, the tool does not modify its environment.\n     *\n     * Default: `false`\n     */\n    readOnlyHint: z.boolean().optional(),\n\n    /**\n     * If `true`, the tool may perform destructive updates to its environment.\n     * If `false`, the tool performs only additive updates.\n     *\n     * (This property is meaningful only when `readOnlyHint == false`)\n     *\n     * Default: `true`\n     */\n    destructiveHint: z.boolean().optional(),\n\n    /**\n     * If `true`, calling the tool repeatedly with the same arguments\n     * will have no additional effect on its environment.\n     *\n     * (This property is meaningful only when `readOnlyHint == false`)\n     *\n     * Default: `false`\n     */\n    idempotentHint: z.boolean().optional(),\n\n    /**\n     * If `true`, this tool may interact with an \"open world\" of external\n     * entities. If `false`, the tool's domain of interaction is closed.\n     * For example, the world of a web search tool is open, whereas that\n     * of a memory tool is not.\n     *\n     * Default: `true`\n     */\n    openWorldHint: z.boolean().optional()\n});\n\n/**\n * Execution-related properties for a tool.\n */\nexport const ToolExecutionSchema = z.object({\n    /**\n     * Indicates the tool's preference for task-augmented execution.\n     * - `\"required\"`: Clients MUST invoke the tool as a task\n     * - `\"optional\"`: Clients MAY invoke the tool as a task or normal request\n     * - `\"forbidden\"`: Clients MUST NOT attempt to invoke the tool as a task\n     *\n     * If not present, defaults to `\"forbidden\"`.\n     */\n    taskSupport: z.enum(['required', 'optional', 'forbidden']).optional()\n});\n\n/**\n * Definition for a tool the client can call.\n */\nexport const ToolSchema = z.object({\n    ...BaseMetadataSchema.shape,\n    ...IconsSchema.shape,\n    /**\n     * A human-readable description of the tool.\n     */\n    description: z.string().optional(),\n    /**\n     * A JSON Schema 2020-12 object defining the expected parameters for the tool.\n     * Must have `type: 'object'` at the root level per MCP spec.\n     */\n    inputSchema: z\n        .object({\n            type: z.literal('object'),\n            properties: z.record(z.string(), JSONValueSchema).optional(),\n            required: z.array(z.string()).optional()\n        })\n        .catchall(z.unknown()),\n    /**\n     * An optional JSON Schema 2020-12 object defining the structure of the tool's output\n     * returned in the `structuredContent` field of a `CallToolResult`.\n     * Must have `type: 'object'` at the root level per MCP spec.\n     */\n    outputSchema: z\n        .object({\n            type: z.literal('object'),\n            properties: z.record(z.string(), JSONValueSchema).optional(),\n            required: z.array(z.string()).optional()\n        })\n        .catchall(z.unknown())\n        .optional(),\n    /**\n     * Optional additional tool information.\n     */\n    annotations: ToolAnnotationsSchema.optional(),\n    /**\n     * Execution-related properties for this tool.\n     */\n    execution: ToolExecutionSchema.optional(),\n\n    /**\n     * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n     * for notes on `_meta` usage.\n     */\n    _meta: z.record(z.string(), z.unknown()).optional()\n});\n\n/**\n * Sent from the client to request a list of tools the server has.\n */\nexport const ListToolsRequestSchema = PaginatedRequestSchema.extend({\n    method: z.literal('tools/list')\n});\n\n/**\n * The server's response to a {@linkcode ListToolsRequest | tools/list} request from the client.\n */\nexport const ListToolsResultSchema = PaginatedResultSchema.extend({\n    tools: z.array(ToolSchema)\n});\n\n/**\n * The server's response to a tool call.\n */\nexport const CallToolResultSchema = ResultSchema.extend({\n    /**\n     * A list of content objects that represent the result of the tool call.\n     *\n     * If the `Tool` does not define an outputSchema, this field MUST be present in the result.\n     * For backwards compatibility, this field is always present, but it may be empty.\n     */\n    content: z.array(ContentBlockSchema).default([]),\n\n    /**\n     * An object containing structured tool output.\n     *\n     * If the `Tool` defines an outputSchema, this field MUST be present in the result, and contain a JSON object that matches the schema.\n     */\n    structuredContent: z.record(z.string(), z.unknown()).optional(),\n\n    /**\n     * Whether the tool call ended in an error.\n     *\n     * If not set, this is assumed to be `false` (the call was successful).\n     *\n     * Any errors that originate from the tool SHOULD be reported inside the result\n     * object, with `isError` set to `true`, _not_ as an MCP protocol-level error\n     * response. Otherwise, the LLM would not be able to see that an error occurred\n     * and self-correct.\n     *\n     * However, any errors in _finding_ the tool, an error indicating that the\n     * server does not support tool calls, or any other exceptional conditions,\n     * should be reported as an MCP error response.\n     */\n    isError: z.boolean().optional()\n});\n\n/**\n * {@linkcode CallToolResultSchema} extended with backwards compatibility to protocol version 2024-10-07.\n */\nexport const CompatibilityCallToolResultSchema = CallToolResultSchema.or(\n    ResultSchema.extend({\n        toolResult: z.unknown()\n    })\n);\n\n/**\n * Parameters for a `tools/call` request.\n */\nexport const CallToolRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({\n    /**\n     * The name of the tool to call.\n     */\n    name: z.string(),\n    /**\n     * Arguments to pass to the tool.\n     */\n    arguments: z.record(z.string(), z.unknown()).optional()\n});\n\n/**\n * Used by the client to invoke a tool provided by the server.\n */\nexport const CallToolRequestSchema = RequestSchema.extend({\n    method: z.literal('tools/call'),\n    params: CallToolRequestParamsSchema\n});\n\n/**\n * An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.\n */\nexport const ToolListChangedNotificationSchema = NotificationSchema.extend({\n    method: z.literal('notifications/tools/list_changed'),\n    params: NotificationsParamsSchema.optional()\n});\n\n/**\n * Base schema for list changed subscription options (without callback).\n * Used internally for Zod validation of `autoRefresh` and `debounceMs`.\n */\nexport const ListChangedOptionsBaseSchema = z.object({\n    /**\n     * If `true`, the list will be refreshed automatically when a list changed notification is received.\n     * The callback will be called with the updated list.\n     *\n     * If `false`, the callback will be called with `null` items, allowing manual refresh.\n     *\n     * @default true\n     */\n    autoRefresh: z.boolean().default(true),\n    /**\n     * Debounce time in milliseconds for list changed notification processing.\n     *\n     * Multiple notifications received within this timeframe will only trigger one refresh.\n     * Set to `0` to disable debouncing.\n     *\n     * @default 300\n     */\n    debounceMs: z.number().int().nonnegative().default(300)\n});\n\n/* Logging */\n/**\n * The severity of a log message.\n */\nexport const LoggingLevelSchema = z.enum(['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency']);\n\n/**\n * Parameters for a `logging/setLevel` request.\n */\nexport const SetLevelRequestParamsSchema = BaseRequestParamsSchema.extend({\n    /**\n     * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as `notifications/logging/message`.\n     */\n    level: LoggingLevelSchema\n});\n/**\n * A request from the client to the server, to enable or adjust logging.\n */\nexport const SetLevelRequestSchema = RequestSchema.extend({\n    method: z.literal('logging/setLevel'),\n    params: SetLevelRequestParamsSchema\n});\n\n/**\n * Parameters for a `notifications/message` notification.\n */\nexport const LoggingMessageNotificationParamsSchema = NotificationsParamsSchema.extend({\n    /**\n     * The severity of this log message.\n     */\n    level: LoggingLevelSchema,\n    /**\n     * An optional name of the logger issuing this message.\n     */\n    logger: z.string().optional(),\n    /**\n     * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.\n     */\n    data: z.unknown()\n});\n/**\n * Notification of a log message passed from server to client. If no `logging/setLevel` request has been sent from the client, the server MAY decide which messages to send automatically.\n */\nexport const LoggingMessageNotificationSchema = NotificationSchema.extend({\n    method: z.literal('notifications/message'),\n    params: LoggingMessageNotificationParamsSchema\n});\n\n/* Per-request `_meta` envelope */\n/**\n * The per-request `_meta` envelope carried by every request under protocol revision\n * 2026-07-28: the protocol version governing the request, the client implementation\n * info, and the client's capabilities — declared per request rather than once at\n * initialization — plus the optional log-level opt-in.\n *\n * This schema models the complete envelope on its own. The base request schemas\n * ({@linkcode RequestMetaSchema}) deliberately stay lenient so the same wire schemas\n * parse requests from earlier protocol revisions (no envelope) as well; envelope\n * requiredness is enforced per request at dispatch time, not here.\n */\nexport const RequestMetaEnvelopeSchema = z.looseObject({\n    /**\n     * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\n     */\n    progressToken: ProgressTokenSchema.optional(),\n    /**\n     * The MCP protocol version being used for this request. For the HTTP transport,\n     * the value must match the `MCP-Protocol-Version` header.\n     */\n    [PROTOCOL_VERSION_META_KEY]: z.string(),\n    /**\n     * Identifies the client software making the request.\n     */\n    [CLIENT_INFO_META_KEY]: ImplementationSchema,\n    /**\n     * The client's capabilities for this specific request. An empty object means the\n     * client supports no optional capabilities. Servers must not infer capabilities\n     * from prior requests.\n     */\n    [CLIENT_CAPABILITIES_META_KEY]: ClientCapabilitiesSchema,\n    /**\n     * The desired log level for this request. When absent, the server must not send\n     * `notifications/message` notifications for the request.\n     *\n     * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains\n     * in the specification for at least twelve months.\n     */\n    [LOG_LEVEL_META_KEY]: LoggingLevelSchema.optional()\n});\n\n/* Sampling */\n/**\n * Hints to use for model selection.\n */\nexport const ModelHintSchema = z.object({\n    /**\n     * A hint for a model name.\n     */\n    name: z.string().optional()\n});\n\n/**\n * The server's preferences for model selection, requested of the client during sampling.\n */\nexport const ModelPreferencesSchema = z.object({\n    /**\n     * Optional hints to use for model selection.\n     */\n    hints: z.array(ModelHintSchema).optional(),\n    /**\n     * How much to prioritize cost when selecting a model.\n     */\n    costPriority: z.number().min(0).max(1).optional(),\n    /**\n     * How much to prioritize sampling speed (latency) when selecting a model.\n     */\n    speedPriority: z.number().min(0).max(1).optional(),\n    /**\n     * How much to prioritize intelligence and capabilities when selecting a model.\n     */\n    intelligencePriority: z.number().min(0).max(1).optional()\n});\n\n/**\n * Controls tool usage behavior in sampling requests.\n */\nexport const ToolChoiceSchema = z.object({\n    /**\n     * Controls when tools are used:\n     * - `\"auto\"`: Model decides whether to use tools (default)\n     * - `\"required\"`: Model MUST use at least one tool before completing\n     * - `\"none\"`: Model MUST NOT use any tools\n     */\n    mode: z.enum(['auto', 'required', 'none']).optional()\n});\n\n/**\n * The result of a tool execution, provided by the user (server).\n * Represents the outcome of invoking a tool requested via `ToolUseContent`.\n */\nexport const ToolResultContentSchema = z.object({\n    type: z.literal('tool_result'),\n    toolUseId: z.string().describe('The unique identifier for the corresponding tool call.'),\n    content: z.array(ContentBlockSchema).default([]),\n    structuredContent: z.object({}).loose().optional(),\n    isError: z.boolean().optional(),\n\n    /**\n     * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n     * for notes on `_meta` usage.\n     */\n    _meta: z.record(z.string(), z.unknown()).optional()\n});\n\n/**\n * Basic content types for sampling responses (without tool use).\n * Used for backwards-compatible {@linkcode CreateMessageResult} when tools are not used.\n */\nexport const SamplingContentSchema = z.discriminatedUnion('type', [TextContentSchema, ImageContentSchema, AudioContentSchema]);\n\n/**\n * Content block types allowed in sampling messages.\n * This includes text, image, audio, tool use requests, and tool results.\n */\nexport const SamplingMessageContentBlockSchema = z.discriminatedUnion('type', [\n    TextContentSchema,\n    ImageContentSchema,\n    AudioContentSchema,\n    ToolUseContentSchema,\n    ToolResultContentSchema\n]);\n\n/**\n * Describes a message issued to or received from an LLM API.\n */\nexport const SamplingMessageSchema = z.object({\n    role: RoleSchema,\n    content: z.union([SamplingMessageContentBlockSchema, z.array(SamplingMessageContentBlockSchema)]),\n    /**\n     * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n     * for notes on `_meta` usage.\n     */\n    _meta: z.record(z.string(), z.unknown()).optional()\n});\n\n/**\n * Parameters for a `sampling/createMessage` request.\n */\nexport const CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({\n    messages: z.array(SamplingMessageSchema),\n    /**\n     * The server's preferences for which model to select. The client MAY modify or omit this request.\n     */\n    modelPreferences: ModelPreferencesSchema.optional(),\n    /**\n     * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.\n     */\n    systemPrompt: z.string().optional(),\n    /**\n     * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.\n     * The client MAY ignore this request.\n     *\n     * Default is `\"none\"`. Values `\"thisServer\"` and `\"allServers\"` are soft-deprecated. Servers SHOULD only use these values if the client\n     * declares `ClientCapabilities`.`sampling.context`. These values may be removed in future spec releases.\n     */\n    includeContext: z.enum(['none', 'thisServer', 'allServers']).optional(),\n    temperature: z.number().optional(),\n    /**\n     * The requested maximum number of tokens to sample (to prevent runaway completions).\n     *\n     * The client MAY choose to sample fewer tokens than the requested maximum.\n     */\n    maxTokens: z.number().int(),\n    stopSequences: z.array(z.string()).optional(),\n    /**\n     * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.\n     */\n    metadata: JSONObjectSchema.optional(),\n    /**\n     * Tools that the model may use during generation.\n     * The client MUST return an error if this field is provided but `ClientCapabilities`.`sampling.tools` is not declared.\n     */\n    tools: z.array(ToolSchema).optional(),\n    /**\n     * Controls how the model uses tools.\n     * The client MUST return an error if this field is provided but `ClientCapabilities`.`sampling.tools` is not declared.\n     * Default is `{ mode: \"auto\" }`.\n     */\n    toolChoice: ToolChoiceSchema.optional()\n});\n/**\n * A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.\n */\nexport const CreateMessageRequestSchema = RequestSchema.extend({\n    method: z.literal('sampling/createMessage'),\n    params: CreateMessageRequestParamsSchema\n});\n\n/**\n * The client's response to a `sampling/create_message` request from the server.\n * This is the backwards-compatible version that returns single content (no arrays).\n * Used when the request does not include tools.\n */\nexport const CreateMessageResultSchema = ResultSchema.extend({\n    /**\n     * The name of the model that generated the message.\n     */\n    model: z.string(),\n    /**\n     * The reason why sampling stopped, if known.\n     *\n     * Standard values:\n     * - `\"endTurn\"`: Natural end of the assistant's turn\n     * - `\"stopSequence\"`: A stop sequence was encountered\n     * - `\"maxTokens\"`: Maximum token limit was reached\n     *\n     * This field is an open string to allow for provider-specific stop reasons.\n     */\n    stopReason: z.optional(z.enum(['endTurn', 'stopSequence', 'maxTokens']).or(z.string())),\n    role: RoleSchema,\n    /**\n     * Response content. Single content block (text, image, or audio).\n     */\n    content: SamplingContentSchema\n});\n\n/**\n * The client's response to a `sampling/create_message` request when tools were provided.\n * This version supports array content for tool use flows.\n */\nexport const CreateMessageResultWithToolsSchema = ResultSchema.extend({\n    /**\n     * The name of the model that generated the message.\n     */\n    model: z.string(),\n    /**\n     * The reason why sampling stopped, if known.\n     *\n     * Standard values:\n     * - `\"endTurn\"`: Natural end of the assistant's turn\n     * - `\"stopSequence\"`: A stop sequence was encountered\n     * - `\"maxTokens\"`: Maximum token limit was reached\n     * - `\"toolUse\"`: The model wants to use one or more tools\n     *\n     * This field is an open string to allow for provider-specific stop reasons.\n     */\n    stopReason: z.optional(z.enum(['endTurn', 'stopSequence', 'maxTokens', 'toolUse']).or(z.string())),\n    role: RoleSchema,\n    /**\n     * Response content. May be a single block or array. May include `ToolUseContent` if `stopReason` is `\"toolUse\"`.\n     */\n    content: z.union([SamplingMessageContentBlockSchema, z.array(SamplingMessageContentBlockSchema)])\n});\n\n/* Elicitation */\n/**\n * Primitive schema definition for boolean fields.\n */\nexport const BooleanSchemaSchema = z.object({\n    type: z.literal('boolean'),\n    title: z.string().optional(),\n    description: z.string().optional(),\n    default: z.boolean().optional()\n});\n\n/**\n * Primitive schema definition for string fields.\n */\nexport const StringSchemaSchema = z.object({\n    type: z.literal('string'),\n    title: z.string().optional(),\n    description: z.string().optional(),\n    minLength: z.number().optional(),\n    maxLength: z.number().optional(),\n    format: z.enum(['email', 'uri', 'date', 'date-time']).optional(),\n    default: z.string().optional()\n});\n\n/**\n * Primitive schema definition for number fields.\n */\nexport const NumberSchemaSchema = z.object({\n    type: z.enum(['number', 'integer']),\n    title: z.string().optional(),\n    description: z.string().optional(),\n    minimum: z.number().optional(),\n    maximum: z.number().optional(),\n    default: z.number().optional()\n});\n\n/**\n * Schema for single-selection enumeration without display titles for options.\n */\nexport const UntitledSingleSelectEnumSchemaSchema = z.object({\n    type: z.literal('string'),\n    title: z.string().optional(),\n    description: z.string().optional(),\n    enum: z.array(z.string()),\n    default: z.string().optional()\n});\n\n/**\n * Schema for single-selection enumeration with display titles for each option.\n */\nexport const TitledSingleSelectEnumSchemaSchema = z.object({\n    type: z.literal('string'),\n    title: z.string().optional(),\n    description: z.string().optional(),\n    oneOf: z.array(\n        z.object({\n            const: z.string(),\n            title: z.string()\n        })\n    ),\n    default: z.string().optional()\n});\n\n/**\n * Use {@linkcode TitledSingleSelectEnumSchema} instead.\n * This interface will be removed in a future version.\n */\nexport const LegacyTitledEnumSchemaSchema = z.object({\n    type: z.literal('string'),\n    title: z.string().optional(),\n    description: z.string().optional(),\n    enum: z.array(z.string()),\n    enumNames: z.array(z.string()).optional(),\n    default: z.string().optional()\n});\n\n// Combined single selection enumeration\nexport const SingleSelectEnumSchemaSchema = z.union([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]);\n\n/**\n * Schema for multiple-selection enumeration without display titles for options.\n */\nexport const UntitledMultiSelectEnumSchemaSchema = z.object({\n    type: z.literal('array'),\n    title: z.string().optional(),\n    description: z.string().optional(),\n    minItems: z.number().optional(),\n    maxItems: z.number().optional(),\n    items: z.object({\n        type: z.literal('string'),\n        enum: z.array(z.string())\n    }),\n    default: z.array(z.string()).optional()\n});\n\n/**\n * Schema for multiple-selection enumeration with display titles for each option.\n */\nexport const TitledMultiSelectEnumSchemaSchema = z.object({\n    type: z.literal('array'),\n    title: z.string().optional(),\n    description: z.string().optional(),\n    minItems: z.number().optional(),\n    maxItems: z.number().optional(),\n    items: z.object({\n        anyOf: z.array(\n            z.object({\n                const: z.string(),\n                title: z.string()\n            })\n        )\n    }),\n    default: z.array(z.string()).optional()\n});\n\n/**\n * Combined schema for multiple-selection enumeration\n */\nexport const MultiSelectEnumSchemaSchema = z.union([UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema]);\n\n/**\n * Primitive schema definition for enum fields.\n */\nexport const EnumSchemaSchema = z.union([LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema]);\n\n/**\n * Union of all primitive schema definitions.\n */\nexport const PrimitiveSchemaDefinitionSchema = z.union([EnumSchemaSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema]);\n\n/**\n * Parameters for an `elicitation/create` request for form-based elicitation.\n */\nexport const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({\n    /**\n     * The elicitation mode.\n     *\n     * Optional for backward compatibility. Clients MUST treat missing `mode` as `\"form\"`.\n     */\n    mode: z.literal('form').optional(),\n    /**\n     * The message to present to the user describing what information is being requested.\n     */\n    message: z.string(),\n    /**\n     * A restricted subset of JSON Schema.\n     * Only top-level properties are allowed, without nesting.\n     */\n    requestedSchema: z\n        .object({\n            type: z.literal('object'),\n            properties: z.record(z.string(), PrimitiveSchemaDefinitionSchema),\n            required: z.array(z.string()).optional()\n        })\n        .catchall(z.unknown())\n});\n\n/**\n * Parameters for an {@linkcode ElicitRequest | elicitation/create} request for URL-based elicitation.\n */\nexport const ElicitRequestURLParamsSchema = TaskAugmentedRequestParamsSchema.extend({\n    /**\n     * The elicitation mode.\n     */\n    mode: z.literal('url'),\n    /**\n     * The message to present to the user explaining why the interaction is needed.\n     */\n    message: z.string(),\n    /**\n     * The ID of the elicitation, which must be unique within the context of the server.\n     * The client MUST treat this ID as an opaque value.\n     */\n    elicitationId: z.string(),\n    /**\n     * The URL that the user should navigate to.\n     */\n    url: z.string().url()\n});\n\n/**\n * The parameters for a request to elicit additional information from the user via the client.\n */\nexport const ElicitRequestParamsSchema = z.union([ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema]);\n\n/**\n * A request from the server to elicit user input via the client.\n * The client should present the message and form fields to the user (form mode)\n * or navigate to a URL (URL mode).\n */\nexport const ElicitRequestSchema = RequestSchema.extend({\n    method: z.literal('elicitation/create'),\n    params: ElicitRequestParamsSchema\n});\n\n/**\n * Parameters for a {@linkcode ElicitationCompleteNotification | notifications/elicitation/complete} notification.\n *\n * @category notifications/elicitation/complete\n */\nexport const ElicitationCompleteNotificationParamsSchema = NotificationsParamsSchema.extend({\n    /**\n     * The ID of the elicitation that completed.\n     */\n    elicitationId: z.string()\n});\n\n/**\n * A notification from the server to the client, informing it of a completion of an out-of-band elicitation request.\n *\n * @category notifications/elicitation/complete\n */\nexport const ElicitationCompleteNotificationSchema = NotificationSchema.extend({\n    method: z.literal('notifications/elicitation/complete'),\n    params: ElicitationCompleteNotificationParamsSchema\n});\n\n/**\n * The client's response to an {@linkcode ElicitRequest | elicitation/create} request from the server.\n */\nexport const ElicitResultSchema = ResultSchema.extend({\n    /**\n     * The user action in response to the elicitation.\n     * - `\"accept\"`: User submitted the form/confirmed the action\n     * - `\"decline\"`: User explicitly declined the action\n     * - `\"cancel\"`: User dismissed without making an explicit choice\n     */\n    action: z.enum(['accept', 'decline', 'cancel']),\n    /**\n     * The submitted form data, only present when action is `\"accept\"`.\n     * Contains values matching the requested schema.\n     * Per MCP spec, content is \"typically omitted\" for decline/cancel actions.\n     * We normalize `null` to `undefined` for leniency while maintaining type compatibility.\n     */\n    content: z.preprocess(\n        val => (val === null ? undefined : val),\n        z.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.array(z.string())])).optional()\n    )\n});\n\n/* Autocomplete */\n/**\n * A reference to a resource or resource template definition.\n */\nexport const ResourceTemplateReferenceSchema = z.object({\n    type: z.literal('ref/resource'),\n    /**\n     * The URI or URI template of the resource.\n     */\n    uri: z.string()\n});\n\n/**\n * Identifies a prompt.\n */\nexport const PromptReferenceSchema = z.object({\n    type: z.literal('ref/prompt'),\n    /**\n     * The name of the prompt or prompt template\n     */\n    name: z.string()\n});\n\n/**\n * Parameters for a {@linkcode CompleteRequest | completion/complete} request.\n */\nexport const CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({\n    ref: z.union([PromptReferenceSchema, ResourceTemplateReferenceSchema]),\n    /**\n     * The argument's information\n     */\n    argument: z.object({\n        /**\n         * The name of the argument\n         */\n        name: z.string(),\n        /**\n         * The value of the argument to use for completion matching.\n         */\n        value: z.string()\n    }),\n    context: z\n        .object({\n            /**\n             * Previously-resolved variables in a URI template or prompt.\n             */\n            arguments: z.record(z.string(), z.string()).optional()\n        })\n        .optional()\n});\n/**\n * A request from the client to the server, to ask for completion options.\n */\nexport const CompleteRequestSchema = RequestSchema.extend({\n    method: z.literal('completion/complete'),\n    params: CompleteRequestParamsSchema\n});\n\n/**\n * The server's response to a {@linkcode CompleteRequest | completion/complete} request\n */\nexport const CompleteResultSchema = ResultSchema.extend({\n    completion: z.looseObject({\n        /**\n         * An array of completion values. Must not exceed 100 items.\n         */\n        values: z.array(z.string()).max(100),\n        /**\n         * The total number of completion options available. This can exceed the number of values actually sent in the response.\n         */\n        total: z.optional(z.number().int()),\n        /**\n         * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.\n         */\n        hasMore: z.optional(z.boolean())\n    })\n});\n\n/* Roots */\n/**\n * Represents a root directory or file that the server can operate on.\n */\nexport const RootSchema = z.object({\n    /**\n     * The URI identifying the root. This *must* start with `file://` for now.\n     */\n    uri: z.string().startsWith('file://'),\n    /**\n     * An optional name for the root.\n     */\n    name: z.string().optional(),\n\n    /**\n     * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)\n     * for notes on `_meta` usage.\n     */\n    _meta: z.record(z.string(), z.unknown()).optional()\n});\n\n/**\n * Sent from the server to request a list of root URIs from the client.\n */\nexport const ListRootsRequestSchema = RequestSchema.extend({\n    method: z.literal('roots/list'),\n    params: BaseRequestParamsSchema.optional()\n});\n\n/**\n * The client's response to a `roots/list` request from the server.\n */\nexport const ListRootsResultSchema = ResultSchema.extend({\n    roots: z.array(RootSchema)\n});\n\n/**\n * A notification from the client to the server, informing it that the list of roots has changed.\n */\nexport const RootsListChangedNotificationSchema = NotificationSchema.extend({\n    method: z.literal('notifications/roots/list_changed'),\n    params: NotificationsParamsSchema.optional()\n});\n\n/* Client messages */\nexport const ClientRequestSchema = z.union([\n    PingRequestSchema,\n    InitializeRequestSchema,\n    CompleteRequestSchema,\n    SetLevelRequestSchema,\n    GetPromptRequestSchema,\n    ListPromptsRequestSchema,\n    ListResourcesRequestSchema,\n    ListResourceTemplatesRequestSchema,\n    ReadResourceRequestSchema,\n    SubscribeRequestSchema,\n    UnsubscribeRequestSchema,\n    CallToolRequestSchema,\n    ListToolsRequestSchema,\n    GetTaskRequestSchema,\n    GetTaskPayloadRequestSchema,\n    ListTasksRequestSchema,\n    CancelTaskRequestSchema\n]);\n\nexport const ClientNotificationSchema = z.union([\n    CancelledNotificationSchema,\n    ProgressNotificationSchema,\n    InitializedNotificationSchema,\n    RootsListChangedNotificationSchema,\n    TaskStatusNotificationSchema\n]);\n\nexport const ClientResultSchema = z.union([\n    EmptyResultSchema,\n    CreateMessageResultSchema,\n    CreateMessageResultWithToolsSchema,\n    ElicitResultSchema,\n    ListRootsResultSchema,\n    GetTaskResultSchema,\n    ListTasksResultSchema,\n    CreateTaskResultSchema\n]);\n\n/* Server messages */\nexport const ServerRequestSchema = z.union([\n    PingRequestSchema,\n    CreateMessageRequestSchema,\n    ElicitRequestSchema,\n    ListRootsRequestSchema,\n    GetTaskRequestSchema,\n    GetTaskPayloadRequestSchema,\n    ListTasksRequestSchema,\n    CancelTaskRequestSchema\n]);\n\nexport const ServerNotificationSchema = z.union([\n    CancelledNotificationSchema,\n    ProgressNotificationSchema,\n    LoggingMessageNotificationSchema,\n    ResourceUpdatedNotificationSchema,\n    ResourceListChangedNotificationSchema,\n    ToolListChangedNotificationSchema,\n    PromptListChangedNotificationSchema,\n    TaskStatusNotificationSchema,\n    ElicitationCompleteNotificationSchema\n]);\n\nexport const ServerResultSchema = z.union([\n    EmptyResultSchema,\n    InitializeResultSchema,\n    CompleteResultSchema,\n    GetPromptResultSchema,\n    ListPromptsResultSchema,\n    ListResourcesResultSchema,\n    ListResourceTemplatesResultSchema,\n    ReadResourceResultSchema,\n    CallToolResultSchema,\n    ListToolsResultSchema,\n    GetTaskResultSchema,\n    ListTasksResultSchema,\n    CreateTaskResultSchema\n]);\n\n/* Runtime schema lookup — result schemas by method */\nconst resultSchemas: Record<string, z.core.$ZodType> = {\n    ping: EmptyResultSchema,\n    initialize: InitializeResultSchema,\n    'completion/complete': CompleteResultSchema,\n    'logging/setLevel': EmptyResultSchema,\n    'prompts/get': GetPromptResultSchema,\n    'prompts/list': ListPromptsResultSchema,\n    'resources/list': ListResourcesResultSchema,\n    'resources/templates/list': ListResourceTemplatesResultSchema,\n    'resources/read': ReadResourceResultSchema,\n    'resources/subscribe': EmptyResultSchema,\n    'resources/unsubscribe': EmptyResultSchema,\n    'tools/call': z.union([CallToolResultSchema, CreateTaskResultSchema]),\n    'tools/list': ListToolsResultSchema,\n    'sampling/createMessage': z.union([CreateMessageResultWithToolsSchema, CreateTaskResultSchema]),\n    'elicitation/create': z.union([ElicitResultSchema, CreateTaskResultSchema]),\n    'roots/list': ListRootsResultSchema,\n    'tasks/get': GetTaskResultSchema,\n    'tasks/result': ResultSchema,\n    'tasks/list': ListTasksResultSchema,\n    'tasks/cancel': CancelTaskResultSchema\n};\n\n/**\n * Gets the Zod schema for validating results of a given request method.\n * Returns `undefined` for non-spec methods.\n * @see getRequestSchema for explanation of the internal type assertion.\n */\nexport function getResultSchema<M extends RequestMethod>(method: M): z.ZodType<ResultTypeMap[M]>;\nexport function getResultSchema(method: string): z.ZodType | undefined;\nexport function getResultSchema(method: string): z.ZodType | undefined {\n    return resultSchemas[method as RequestMethod] as unknown as z.ZodType | undefined;\n}\n\n/* Runtime schema lookup — request schemas by method */\ntype RequestSchemaType = (typeof ClientRequestSchema.options)[number] | (typeof ServerRequestSchema.options)[number];\ntype NotificationSchemaType = (typeof ClientNotificationSchema.options)[number] | (typeof ServerNotificationSchema.options)[number];\n\nfunction buildSchemaMap<T extends { shape: { method: { value: string } } }>(schemas: readonly T[]): Record<string, T> {\n    const map: Record<string, T> = {};\n    for (const schema of schemas) {\n        const method = schema.shape.method.value;\n        map[method] = schema;\n    }\n    return map;\n}\n\nconst requestSchemas = buildSchemaMap([...ClientRequestSchema.options, ...ServerRequestSchema.options] as const) as Record<\n    RequestMethod,\n    RequestSchemaType\n>;\nconst notificationSchemas = buildSchemaMap([...ClientNotificationSchema.options, ...ServerNotificationSchema.options] as const) as Record<\n    NotificationMethod,\n    NotificationSchemaType\n>;\n\n/**\n * Gets the Zod schema for a given request method.\n * Returns `undefined` for non-spec methods.\n * The return type is a ZodType that parses to RequestTypeMap[M], allowing callers\n * to use schema.parse() without needing additional type assertions.\n *\n * Note: The internal cast is necessary because TypeScript can't correlate the\n * Record-based schema lookup with the MethodToTypeMap-based RequestTypeMap\n * when M is a generic type parameter. Both compute to the same type at\n * instantiation, but TypeScript can't prove this statically.\n */\nexport function getRequestSchema<M extends RequestMethod>(method: M): z.ZodType<RequestTypeMap[M]>;\nexport function getRequestSchema(method: string): z.ZodType | undefined;\nexport function getRequestSchema(method: string): z.ZodType | undefined {\n    return requestSchemas[method as RequestMethod] as unknown as z.ZodType | undefined;\n}\n\n/**\n * Gets the Zod schema for a given notification method.\n * Returns `undefined` for non-spec methods.\n * @see getRequestSchema for explanation of the internal type assertion.\n */\nexport function getNotificationSchema<M extends NotificationMethod>(method: M): z.ZodType<NotificationTypeMap[M]>;\nexport function getNotificationSchema(method: string): z.ZodType | undefined;\nexport function getNotificationSchema(method: string): z.ZodType | undefined {\n    return notificationSchemas[method as NotificationMethod] as unknown as z.ZodType | undefined;\n}\n","import {\n    CallToolResultSchema,\n    InitializedNotificationSchema,\n    InitializeRequestSchema,\n    JSONRPCErrorResponseSchema,\n    JSONRPCMessageSchema,\n    JSONRPCNotificationSchema,\n    JSONRPCRequestSchema,\n    JSONRPCResponseSchema,\n    JSONRPCResultResponseSchema,\n    TaskAugmentedRequestParamsSchema\n} from './schemas';\nimport type {\n    CallToolResult,\n    CompleteRequest,\n    CompleteRequestPrompt,\n    CompleteRequestResourceTemplate,\n    InitializedNotification,\n    InitializeRequest,\n    JSONRPCErrorResponse,\n    JSONRPCMessage,\n    JSONRPCNotification,\n    JSONRPCRequest,\n    JSONRPCResponse,\n    JSONRPCResultResponse,\n    TaskAugmentedRequestParams\n} from './types';\n\n/**\n * Validates and parses an unknown value as a JSON-RPC message.\n *\n * Use this to validate incoming messages in custom transport implementations.\n * Throws if the value does not conform to the JSON-RPC message schema.\n *\n * @param value - The value to validate (typically a parsed JSON object).\n * @returns The validated {@linkcode JSONRPCMessage}.\n * @throws If validation fails.\n */\nexport function parseJSONRPCMessage(value: unknown): JSONRPCMessage {\n    return JSONRPCMessageSchema.parse(value);\n}\n\nexport const isJSONRPCRequest = (value: unknown): value is JSONRPCRequest => JSONRPCRequestSchema.safeParse(value).success;\n\nexport const isJSONRPCNotification = (value: unknown): value is JSONRPCNotification => JSONRPCNotificationSchema.safeParse(value).success;\n\n/**\n * Checks if a value is a valid {@linkcode JSONRPCResultResponse}.\n * @param value - The value to check.\n *\n * @returns True if the value is a valid {@linkcode JSONRPCResultResponse}, false otherwise.\n */\nexport const isJSONRPCResultResponse = (value: unknown): value is JSONRPCResultResponse =>\n    JSONRPCResultResponseSchema.safeParse(value).success;\n\n/**\n * Checks if a value is a valid {@linkcode JSONRPCErrorResponse}.\n * @param value - The value to check.\n *\n * @returns True if the value is a valid {@linkcode JSONRPCErrorResponse}, false otherwise.\n */\nexport const isJSONRPCErrorResponse = (value: unknown): value is JSONRPCErrorResponse =>\n    JSONRPCErrorResponseSchema.safeParse(value).success;\n\n/**\n * Checks if a value is a valid {@linkcode JSONRPCResponse} (either a result or error response).\n * @param value - The value to check.\n *\n * @returns True if the value is a valid {@linkcode JSONRPCResponse}, false otherwise.\n */\nexport const isJSONRPCResponse = (value: unknown): value is JSONRPCResponse => JSONRPCResponseSchema.safeParse(value).success;\n\n/**\n * Checks if a value is a valid {@linkcode CallToolResult}.\n * @param value - The value to check.\n *\n * @returns True if the value is a valid {@linkcode CallToolResult}, false otherwise.\n */\nexport const isCallToolResult = (value: unknown): value is CallToolResult => {\n    if (typeof value !== 'object' || value === null || !('content' in value)) return false;\n    return CallToolResultSchema.safeParse(value).success;\n};\n\n/**\n * Checks if a value is a valid {@linkcode TaskAugmentedRequestParams}.\n * @param value - The value to check.\n *\n * @returns True if the value is a valid {@linkcode TaskAugmentedRequestParams}, false otherwise.\n */\nexport const isTaskAugmentedRequestParams = (value: unknown): value is TaskAugmentedRequestParams =>\n    TaskAugmentedRequestParamsSchema.safeParse(value).success;\n\nexport const isInitializeRequest = (value: unknown): value is InitializeRequest => InitializeRequestSchema.safeParse(value).success;\n\nexport const isInitializedNotification = (value: unknown): value is InitializedNotification =>\n    InitializedNotificationSchema.safeParse(value).success;\n\nexport function assertCompleteRequestPrompt(request: CompleteRequest): asserts request is CompleteRequestPrompt {\n    if (request.params.ref.type !== 'ref/prompt') {\n        throw new TypeError(`Expected CompleteRequestPrompt, but got ${request.params.ref.type}`);\n    }\n    void (request as CompleteRequestPrompt);\n}\n\nexport function assertCompleteRequestResourceTemplate(request: CompleteRequest): asserts request is CompleteRequestResourceTemplate {\n    if (request.params.ref.type !== 'ref/resource') {\n        throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${request.params.ref.type}`);\n    }\n    void (request as CompleteRequestResourceTemplate);\n}\n","import type * as z from 'zod/v4';\n\nimport {\n    IdJagTokenExchangeResponseSchema,\n    OAuthClientInformationFullSchema,\n    OAuthClientInformationSchema,\n    OAuthClientMetadataSchema,\n    OAuthClientRegistrationErrorSchema,\n    OAuthErrorResponseSchema,\n    OAuthMetadataSchema,\n    OAuthProtectedResourceMetadataSchema,\n    OAuthTokenRevocationRequestSchema,\n    OAuthTokensSchema,\n    OpenIdProviderDiscoveryMetadataSchema,\n    OpenIdProviderMetadataSchema\n} from '../shared/auth';\nimport type { StandardSchemaV1, StandardSchemaV1Sync } from '../util/standardSchema';\nimport * as schemas from './schemas';\n\n/**\n * Explicit allowlist of protocol Zod schemas that correspond to a public spec type in `types.ts`.\n *\n * This intentionally excludes internal helper schemas exported from `schemas.ts` that have no\n * matching public type (e.g. `ListChangedOptionsBaseSchema`, `BaseRequestParamsSchema`,\n * `NotificationsParamsSchema`, `ClientTasksCapabilitySchema`, `ServerTasksCapabilitySchema`).\n * Keeping the list explicit means new public spec types must be added here deliberately, and\n * internals never leak into `SpecTypeName`.\n *\n * `ResourceTemplateSchema` is included; its public type is exported as `ResourceTemplateType`\n * (the bare name collides with the server package's `ResourceTemplate` class), so\n * `SpecTypes['ResourceTemplate']` is structurally equal to `ResourceTemplateType` rather than to\n * a type literally named `ResourceTemplate`.\n */\nconst SPEC_SCHEMA_KEYS = [\n    'AnnotationsSchema',\n    'AudioContentSchema',\n    'BaseMetadataSchema',\n    'BlobResourceContentsSchema',\n    'BooleanSchemaSchema',\n    'CallToolRequestSchema',\n    'CallToolRequestParamsSchema',\n    'CallToolResultSchema',\n    'CancelledNotificationSchema',\n    'CancelledNotificationParamsSchema',\n    'CancelTaskRequestSchema',\n    'CancelTaskResultSchema',\n    'ClientCapabilitiesSchema',\n    'ClientNotificationSchema',\n    'ClientRequestSchema',\n    'ClientResultSchema',\n    'CompatibilityCallToolResultSchema',\n    'CompleteRequestSchema',\n    'CompleteRequestParamsSchema',\n    'CompleteResultSchema',\n    'ContentBlockSchema',\n    'CreateMessageRequestSchema',\n    'CreateMessageRequestParamsSchema',\n    'CreateMessageResultSchema',\n    'CreateMessageResultWithToolsSchema',\n    'CreateTaskResultSchema',\n    'CursorSchema',\n    'DiscoverRequestSchema',\n    'DiscoverResultSchema',\n    'ElicitationCompleteNotificationSchema',\n    'ElicitationCompleteNotificationParamsSchema',\n    'ElicitRequestSchema',\n    'ElicitRequestFormParamsSchema',\n    'ElicitRequestParamsSchema',\n    'ElicitRequestURLParamsSchema',\n    'ElicitResultSchema',\n    'EmbeddedResourceSchema',\n    'EmptyResultSchema',\n    'EnumSchemaSchema',\n    'GetPromptRequestSchema',\n    'GetPromptRequestParamsSchema',\n    'GetPromptResultSchema',\n    'GetTaskPayloadRequestSchema',\n    'GetTaskPayloadResultSchema',\n    'GetTaskRequestSchema',\n    'GetTaskResultSchema',\n    'IconSchema',\n    'IconsSchema',\n    'ImageContentSchema',\n    'ImplementationSchema',\n    'InitializedNotificationSchema',\n    'InitializeRequestSchema',\n    'InitializeRequestParamsSchema',\n    'InitializeResultSchema',\n    'JSONArraySchema',\n    'JSONObjectSchema',\n    'JSONRPCErrorResponseSchema',\n    'JSONRPCMessageSchema',\n    'JSONRPCNotificationSchema',\n    'JSONRPCRequestSchema',\n    'JSONRPCResponseSchema',\n    'JSONRPCResultResponseSchema',\n    'JSONValueSchema',\n    'LegacyTitledEnumSchemaSchema',\n    'ListPromptsRequestSchema',\n    'ListPromptsResultSchema',\n    'ListResourcesRequestSchema',\n    'ListResourcesResultSchema',\n    'ListResourceTemplatesRequestSchema',\n    'ListResourceTemplatesResultSchema',\n    'ListRootsRequestSchema',\n    'ListRootsResultSchema',\n    'ListTasksRequestSchema',\n    'ListTasksResultSchema',\n    'ListToolsRequestSchema',\n    'ListToolsResultSchema',\n    'LoggingLevelSchema',\n    'LoggingMessageNotificationSchema',\n    'LoggingMessageNotificationParamsSchema',\n    'ModelHintSchema',\n    'ModelPreferencesSchema',\n    'MultiSelectEnumSchemaSchema',\n    'NotificationSchema',\n    'NumberSchemaSchema',\n    'PaginatedRequestSchema',\n    'PaginatedRequestParamsSchema',\n    'PaginatedResultSchema',\n    'PingRequestSchema',\n    'PrimitiveSchemaDefinitionSchema',\n    'ProgressSchema',\n    'ProgressNotificationSchema',\n    'ProgressNotificationParamsSchema',\n    'ProgressTokenSchema',\n    'PromptSchema',\n    'PromptArgumentSchema',\n    'PromptListChangedNotificationSchema',\n    'PromptMessageSchema',\n    'PromptReferenceSchema',\n    'ReadResourceRequestSchema',\n    'ReadResourceRequestParamsSchema',\n    'ReadResourceResultSchema',\n    'RelatedTaskMetadataSchema',\n    'RequestSchema',\n    'RequestIdSchema',\n    'RequestMetaEnvelopeSchema',\n    'RequestMetaSchema',\n    'ResourceSchema',\n    'ResourceContentsSchema',\n    'ResourceLinkSchema',\n    'ResourceListChangedNotificationSchema',\n    'ResourceRequestParamsSchema',\n    'ResourceTemplateSchema',\n    'ResourceTemplateReferenceSchema',\n    'ResourceUpdatedNotificationSchema',\n    'ResourceUpdatedNotificationParamsSchema',\n    'ResultSchema',\n    'RoleSchema',\n    'RootSchema',\n    'RootsListChangedNotificationSchema',\n    'SamplingContentSchema',\n    'SamplingMessageSchema',\n    'SamplingMessageContentBlockSchema',\n    'ServerCapabilitiesSchema',\n    'ServerNotificationSchema',\n    'ServerRequestSchema',\n    'ServerResultSchema',\n    'SetLevelRequestSchema',\n    'SetLevelRequestParamsSchema',\n    'SingleSelectEnumSchemaSchema',\n    'StringSchemaSchema',\n    'SubscribeRequestSchema',\n    'SubscribeRequestParamsSchema',\n    'TaskSchema',\n    'TaskAugmentedRequestParamsSchema',\n    'TaskCreationParamsSchema',\n    'TaskMetadataSchema',\n    'TaskStatusSchema',\n    'TaskStatusNotificationSchema',\n    'TaskStatusNotificationParamsSchema',\n    'TextContentSchema',\n    'TextResourceContentsSchema',\n    'TitledMultiSelectEnumSchemaSchema',\n    'TitledSingleSelectEnumSchemaSchema',\n    'ToolSchema',\n    'ToolAnnotationsSchema',\n    'ToolChoiceSchema',\n    'ToolExecutionSchema',\n    'ToolListChangedNotificationSchema',\n    'ToolResultContentSchema',\n    'ToolUseContentSchema',\n    'UnsubscribeRequestSchema',\n    'UnsubscribeRequestParamsSchema',\n    'UntitledMultiSelectEnumSchemaSchema',\n    'UntitledSingleSelectEnumSchemaSchema'\n] as const satisfies readonly (keyof typeof schemas)[];\n\nconst authSchemas = {\n    IdJagTokenExchangeResponseSchema,\n    OAuthClientInformationFullSchema,\n    OAuthClientInformationSchema,\n    OAuthClientMetadataSchema,\n    OAuthClientRegistrationErrorSchema,\n    OAuthErrorResponseSchema,\n    OAuthMetadataSchema,\n    OAuthProtectedResourceMetadataSchema,\n    OAuthTokenRevocationRequestSchema,\n    OAuthTokensSchema,\n    OpenIdProviderDiscoveryMetadataSchema,\n    OpenIdProviderMetadataSchema\n} as const;\n\ntype ProtocolSchemaKey = (typeof SPEC_SCHEMA_KEYS)[number];\ntype AuthSchemaKey = keyof typeof authSchemas;\ntype SchemaKey = ProtocolSchemaKey | AuthSchemaKey;\n\ntype SchemaFor<K extends SchemaKey> = K extends ProtocolSchemaKey\n    ? (typeof schemas)[K]\n    : K extends AuthSchemaKey\n      ? (typeof authSchemas)[K]\n      : never;\n\ntype StripSchemaSuffix<K> = K extends `${infer N}Schema` ? N : never;\n\n/**\n * Union of every named type in the SDK's protocol and OAuth schemas (e.g. `'CallToolResult'`,\n * `'ContentBlock'`, `'Tool'`, `'OAuthTokens'`). Derived from the internal Zod schemas, so it stays\n * in sync with the spec.\n */\nexport type SpecTypeName = StripSchemaSuffix<SchemaKey>;\n\n/**\n * Maps each {@linkcode SpecTypeName} to its TypeScript type.\n *\n * `SpecTypes['CallToolResult']` is equivalent to importing the `CallToolResult` type directly.\n */\nexport type SpecTypes = {\n    [K in SchemaKey as StripSchemaSuffix<K>]: SchemaFor<K> extends z.ZodType ? z.output<SchemaFor<K>> : never;\n};\n\n/**\n * Input shape for each {@linkcode SpecTypeName}. For most types this equals {@linkcode SpecTypes},\n * but a few schemas apply defaults/preprocessing, so the accepted input may be looser than the\n * resulting output type.\n */\ntype SpecTypeInputs = {\n    [K in SchemaKey as StripSchemaSuffix<K>]: SchemaFor<K> extends z.ZodType ? z.input<SchemaFor<K>> : never;\n};\n\ntype SchemaRecord = { readonly [K in SpecTypeName]: StandardSchemaV1Sync<SpecTypeInputs[K], SpecTypes[K]> };\ntype GuardRecord = { readonly [K in SpecTypeName]: (value: unknown) => value is SpecTypeInputs[K] };\n\nconst _specTypeSchemas: Record<string, StandardSchemaV1> = {};\nconst _isSpecType: Record<string, (value: unknown) => boolean> = {};\nfunction register(key: string, schema: z.ZodType): void {\n    const name = key.slice(0, -'Schema'.length);\n    _specTypeSchemas[name] = schema;\n    _isSpecType[name] = (v: unknown) => schema.safeParse(v).success;\n}\nfor (const key of SPEC_SCHEMA_KEYS) {\n    // eslint-disable-next-line import/namespace -- key is constrained to keyof typeof schemas via the satisfies clause above\n    register(key, schemas[key]);\n}\nfor (const [key, schema] of Object.entries(authSchemas)) {\n    register(key, schema);\n}\n\n/**\n * Runtime validators for every MCP spec type, keyed by type name.\n *\n * Use this when you need to validate a spec-defined shape at a boundary the SDK does not own, for\n * example an extension's custom-method payload that embeds a `CallToolResult`, or a value read from\n * storage that should be a `Tool`.\n *\n * Each entry implements the Standard Schema interface, so it composes with any\n * Standard-Schema-aware library. For a simple boolean check, use {@linkcode isSpecType} instead.\n *\n * @example\n * ```ts source=\"./specTypeSchema.examples.ts#specTypeSchemas_basicUsage\"\n * const result = specTypeSchemas.CallToolResult['~standard'].validate(untrusted);\n * if (result.issues === undefined) {\n *     // result.value is CallToolResult\n * }\n * ```\n */\nexport const specTypeSchemas: SchemaRecord = Object.freeze(_specTypeSchemas as SchemaRecord);\n\n/**\n * Type predicates for every MCP spec type, keyed by type name.\n *\n * Returns `true` if the value satisfies the schema's input type (`z.input<>`, before defaults and\n * transforms are applied), and narrows to that input type. For schemas with `.default()` or\n * `.preprocess()`, this may accept values that do not structurally match the named output type;\n * for example `isSpecType.CallToolResult({})` is `true` because `content` has a default. Use\n * `specTypeSchemas.X['~standard'].validate(value)` when you need the validated output value.\n *\n * Each guard is a standalone function, so it can be passed directly as a callback.\n *\n * @example\n * ```ts source=\"./specTypeSchema.examples.ts#isSpecType_basicUsage\"\n * if (isSpecType.ContentBlock(value)) {\n *     // value is ContentBlock\n * }\n *\n * const blocks = mixed.filter(isSpecType.ContentBlock);\n * ```\n */\nexport const isSpecType: GuardRecord = Object.freeze(_isSpecType as GuardRecord);\n","/**\n * Standard Schema utilities for user-provided schemas.\n * Supports Zod v4, Valibot, ArkType, and other Standard Schema implementations.\n * @see https://standardschema.dev\n */\n\n/* eslint-disable @typescript-eslint/no-namespace */\n\nimport * as z from 'zod/v4';\n\n// Standard Schema interfaces — vendored from https://standardschema.dev (spec v1, Jan 2025)\n\nexport interface StandardTypedV1<Input = unknown, Output = Input> {\n    readonly '~standard': StandardTypedV1.Props<Input, Output>;\n}\n\nexport namespace StandardTypedV1 {\n    export interface Props<Input = unknown, Output = Input> {\n        readonly version: 1;\n        readonly vendor: string;\n        readonly types?: Types<Input, Output> | undefined;\n    }\n\n    export interface Types<Input = unknown, Output = Input> {\n        readonly input: Input;\n        readonly output: Output;\n    }\n\n    export type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema['~standard']['types']>['input'];\n    export type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema['~standard']['types']>['output'];\n}\n\nexport interface StandardSchemaV1<Input = unknown, Output = Input> {\n    readonly '~standard': StandardSchemaV1.Props<Input, Output>;\n}\n\nexport namespace StandardSchemaV1 {\n    export interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {\n        readonly validate: (value: unknown, options?: Options | undefined) => Result<Output> | Promise<Result<Output>>;\n    }\n\n    export interface Options {\n        readonly libraryOptions?: Record<string, unknown> | undefined;\n    }\n\n    export type Result<Output> = SuccessResult<Output> | FailureResult;\n\n    export interface SuccessResult<Output> {\n        readonly value: Output;\n        readonly issues?: undefined;\n    }\n\n    export interface FailureResult {\n        readonly issues: ReadonlyArray<Issue>;\n    }\n\n    export interface Issue {\n        readonly message: string;\n        readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;\n    }\n\n    export interface PathSegment {\n        readonly key: PropertyKey;\n    }\n\n    export type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;\n    export type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;\n}\n\nexport interface StandardJSONSchemaV1<Input = unknown, Output = Input> {\n    readonly '~standard': StandardJSONSchemaV1.Props<Input, Output>;\n}\n\nexport namespace StandardJSONSchemaV1 {\n    export interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {\n        readonly jsonSchema: Converter;\n    }\n\n    export interface Converter {\n        readonly input: (options: Options) => Record<string, unknown>;\n        readonly output: (options: Options) => Record<string, unknown>;\n    }\n\n    export type Target = 'draft-2020-12' | 'draft-07' | 'openapi-3.0' | (object & string);\n\n    export interface Options {\n        readonly target: Target;\n        readonly libraryOptions?: Record<string, unknown> | undefined;\n    }\n\n    export type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;\n    export type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;\n}\n\n/**\n * Combined interface for schemas with both validation and JSON Schema conversion —\n * the intersection of {@linkcode StandardSchemaV1} and {@linkcode StandardJSONSchemaV1}.\n *\n * This is the type accepted by `registerTool` / `registerPrompt`. The SDK needs\n * `~standard.jsonSchema` to advertise the tool's argument shape in `tools/list`, and\n * `~standard.validate` to check incoming arguments when a `tools/call` arrives.\n *\n * Zod v4, ArkType, and Valibot (via `@valibot/to-json-schema`'s `toStandardJsonSchema`)\n * all implement both interfaces.\n *\n * @see https://standardschema.dev/ for the Standard Schema specification\n */\nexport interface StandardSchemaWithJSON<Input = unknown, Output = Input> {\n    readonly '~standard': StandardSchemaV1.Props<Input, Output> & StandardJSONSchemaV1.Props<Input, Output>;\n}\n\nexport namespace StandardSchemaWithJSON {\n    export type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;\n    export type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;\n}\n\n/**\n * Narrowing of {@linkcode StandardSchemaV1} whose `validate` is guaranteed synchronous.\n *\n * The Zod schemas backing `specTypeSchemas` contain no async refinements or transforms,\n * so every entry satisfies this interface. Consumers can call `validate()` and access\n * `.issues` / `.value` on the result without `await`.\n *\n * `StandardSchemaV1Sync` is assignable to `StandardSchemaV1` — it is a strict subtype.\n */\nexport interface StandardSchemaV1Sync<Input = unknown, Output = Input> extends StandardSchemaV1<Input, Output> {\n    readonly '~standard': StandardSchemaV1Sync.Props<Input, Output>;\n}\n\nexport namespace StandardSchemaV1Sync {\n    export interface Props<Input = unknown, Output = Input> extends StandardSchemaV1.Props<Input, Output> {\n        readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result<Output>;\n    }\n\n    export type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;\n    export type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;\n}\n\n// Type guards\n\nexport function isStandardJSONSchema(schema: unknown): schema is StandardJSONSchemaV1 {\n    if (schema == null) return false;\n    const schemaType = typeof schema;\n    if (schemaType !== 'object' && schemaType !== 'function') return false;\n    if (!('~standard' in (schema as object))) return false;\n    const std = (schema as StandardJSONSchemaV1)['~standard'];\n    return typeof std?.jsonSchema?.input === 'function' && typeof std?.jsonSchema?.output === 'function';\n}\n\nexport function isStandardSchema(schema: unknown): schema is StandardSchemaV1 {\n    if (schema == null) return false;\n    const schemaType = typeof schema;\n    if (schemaType !== 'object' && schemaType !== 'function') return false;\n    if (!('~standard' in (schema as object))) return false;\n    const std = (schema as StandardSchemaV1)['~standard'];\n    return typeof std?.validate === 'function';\n}\n\nexport function isStandardSchemaWithJSON(schema: unknown): schema is StandardSchemaWithJSON {\n    return isStandardJSONSchema(schema) && isStandardSchema(schema);\n}\n\n// JSON Schema conversion\n\nlet warnedZodFallback = false;\n\n/**\n * Converts a StandardSchema to JSON Schema for use as an MCP tool/prompt schema.\n *\n * MCP requires `type: \"object\"` at the root of tool inputSchema/outputSchema and\n * prompt argument schemas. Zod's discriminated unions emit `{oneOf: [...]}` without\n * a top-level `type`, so this function defaults `type` to `\"object\"` when absent.\n *\n * Throws if the schema has an explicit non-object `type` (e.g. `z.string()`),\n * since that cannot satisfy the MCP spec.\n */\nexport function standardSchemaToJsonSchema(schema: StandardJSONSchemaV1, io: 'input' | 'output' = 'input'): Record<string, unknown> {\n    const std = schema['~standard'];\n    let result: Record<string, unknown>;\n    if (std.jsonSchema) {\n        result = std.jsonSchema[io]({ target: 'draft-2020-12' });\n    } else if (std.vendor === 'zod') {\n        // zod 4.0–4.1 implements StandardSchemaV1 but not StandardJSONSchemaV1 (`~standard.jsonSchema`).\n        // The SDK already bundles zod 4, so fall back to its converter rather than crashing on tools/list.\n        // zod 3 schemas (which also report vendor 'zod') have `_def` but not `_zod`; the SDK-bundled\n        // zod 4 `z.toJSONSchema()` cannot introspect them, so throw a clear error instead of crashing.\n        if (!('_zod' in (schema as object))) {\n            throw new Error(\n                'Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. ' +\n                    'Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().'\n            );\n        }\n        if (!warnedZodFallback) {\n            warnedZodFallback = true;\n            console.warn(\n                '[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). ' +\n                    'Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.'\n            );\n        }\n        result = z.toJSONSchema(schema as unknown as z.ZodType, { target: 'draft-2020-12', io }) as Record<string, unknown>;\n    } else {\n        throw new Error(\n            `Schema library \"${std.vendor}\" does not implement StandardJSONSchemaV1 (\\`~standard.jsonSchema\\`). ` +\n                `Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`\n        );\n    }\n    if (result.type !== undefined && result.type !== 'object') {\n        throw new Error(\n            `MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(result.type)}). ` +\n                `Wrap your schema in z.object({...}) or equivalent.`\n        );\n    }\n    return { type: 'object', ...result };\n}\n\n// Validation\n\nexport type StandardSchemaValidationResult<T> = { success: true; data: T } | { success: false; error: string };\n\nfunction formatIssue(issue: StandardSchemaV1.Issue): string {\n    if (!issue.path?.length) return issue.message;\n    const path = issue.path.map(p => String(typeof p === 'object' ? p.key : p)).join('.');\n    return `${path}: ${issue.message}`;\n}\n\nexport async function validateStandardSchema<T extends StandardSchemaV1>(\n    schema: T,\n    data: unknown\n): Promise<StandardSchemaValidationResult<StandardSchemaV1.InferOutput<T>>> {\n    const result = await schema['~standard'].validate(data);\n    if (result.issues && result.issues.length > 0) {\n        return { success: false, error: result.issues.map(i => formatIssue(i)).join(', ') };\n    }\n    return { success: true, data: (result as StandardSchemaV1.SuccessResult<unknown>).value as StandardSchemaV1.InferOutput<T> };\n}\n\n// Prompt argument extraction\n\nexport function promptArgumentsFromStandardSchema(\n    schema: StandardJSONSchemaV1\n): Array<{ name: string; description?: string; required: boolean }> {\n    const jsonSchema = standardSchemaToJsonSchema(schema, 'input');\n    const properties = (jsonSchema.properties as Record<string, { description?: string }>) || {};\n    const required = (jsonSchema.required as string[]) || [];\n\n    return Object.entries(properties).map(([name, prop]) => ({\n        name,\n        description: prop?.description,\n        required: required.includes(name)\n    }));\n}\n","import { SdkError, SdkErrorCode } from '../errors/sdkErrors';\nimport type {\n    AuthInfo,\n    CancelledNotification,\n    ClientCapabilities,\n    CreateMessageRequest,\n    CreateMessageResult,\n    CreateMessageResultWithTools,\n    ElicitRequestFormParams,\n    ElicitRequestURLParams,\n    ElicitResult,\n    JSONRPCErrorResponse,\n    JSONRPCNotification,\n    JSONRPCRequest,\n    JSONRPCResponse,\n    JSONRPCResultResponse,\n    LoggingLevel,\n    MessageExtraInfo,\n    Notification,\n    NotificationMethod,\n    NotificationTypeMap,\n    Progress,\n    ProgressNotification,\n    Request,\n    RequestId,\n    RequestMeta,\n    RequestMethod,\n    RequestTypeMap,\n    Result,\n    ResultTypeMap,\n    ServerCapabilities\n} from '../types/index';\nimport {\n    getNotificationSchema,\n    getRequestSchema,\n    getResultSchema,\n    isJSONRPCErrorResponse,\n    isJSONRPCNotification,\n    isJSONRPCRequest,\n    isJSONRPCResultResponse,\n    ProtocolError,\n    ProtocolErrorCode,\n    SUPPORTED_PROTOCOL_VERSIONS\n} from '../types/index';\nimport type { StandardSchemaV1 } from '../util/standardSchema';\nimport { isStandardSchema, validateStandardSchema } from '../util/standardSchema';\nimport type { Transport, TransportSendOptions } from './transport';\n\n/**\n * Callback for progress notifications.\n */\nexport type ProgressCallback = (progress: Progress) => void;\n\n/**\n * Additional initialization options.\n */\nexport type ProtocolOptions = {\n    /**\n     * Protocol versions supported. First version is preferred (sent by client,\n     * used as fallback by server). Passed to transport during {@linkcode Protocol.connect | connect()}.\n     *\n     * @default {@linkcode SUPPORTED_PROTOCOL_VERSIONS}\n     */\n    supportedProtocolVersions?: string[];\n\n    /**\n     * Whether to restrict emitted requests to only those that the remote side has indicated that they can handle, through their advertised capabilities.\n     *\n     * Note that this DOES NOT affect checking of _local_ side capabilities, as it is considered a logic error to mis-specify those.\n     *\n     * Currently this defaults to `false`, for backwards compatibility with SDK versions that did not advertise capabilities correctly. In future, this will default to `true`.\n     */\n    enforceStrictCapabilities?: boolean;\n    /**\n     * An array of notification method names that should be automatically debounced.\n     * Any notifications with a method in this list will be coalesced if they\n     * occur in the same tick of the event loop.\n     * e.g., `['notifications/tools/list_changed']`\n     */\n    debouncedNotificationMethods?: string[];\n};\n\n/**\n * The default request timeout, in milliseconds.\n */\nexport const DEFAULT_REQUEST_TIMEOUT_MSEC = 60_000;\n\n/**\n * Options that can be given per request.\n */\nexport type RequestOptions = {\n    /**\n     * If set, requests progress notifications from the remote end (if supported). When progress notifications are received, this callback will be invoked.\n     */\n    onprogress?: ProgressCallback;\n\n    /**\n     * Can be used to cancel an in-flight request. This will cause an `AbortError` to be raised from {@linkcode Protocol.request | request()}.\n     */\n    signal?: AbortSignal;\n\n    /**\n     * A timeout (in milliseconds) for this request. If exceeded, an {@linkcode SdkError} with code {@linkcode SdkErrorCode.RequestTimeout} will be raised from {@linkcode Protocol.request | request()}.\n     *\n     * If not specified, {@linkcode DEFAULT_REQUEST_TIMEOUT_MSEC} will be used as the timeout.\n     */\n    timeout?: number;\n\n    /**\n     * If `true`, receiving a progress notification will reset the request timeout.\n     * This is useful for long-running operations that send periodic progress updates.\n     * Default: `false`\n     */\n    resetTimeoutOnProgress?: boolean;\n\n    /**\n     * Maximum total time (in milliseconds) to wait for a response.\n     * If exceeded, an {@linkcode SdkError} with code {@linkcode SdkErrorCode.RequestTimeout} will be raised, regardless of progress notifications.\n     * If not specified, there is no maximum total timeout.\n     */\n    maxTotalTimeout?: number;\n} & TransportSendOptions;\n\n/**\n * Options that can be given per notification.\n */\nexport type NotificationOptions = {\n    /**\n     * May be used to indicate to the transport which incoming request to associate this outgoing notification with.\n     */\n    relatedRequestId?: RequestId;\n};\n\n/**\n * Base context provided to all request handlers.\n */\nexport type BaseContext = {\n    /**\n     * The session ID from the transport, if available.\n     */\n    sessionId?: string;\n\n    /**\n     * Information about the MCP request being handled.\n     */\n    mcpReq: {\n        /**\n         * The JSON-RPC ID of the request being handled.\n         */\n        id: RequestId;\n\n        /**\n         * The method name of the request (e.g., 'tools/call', 'ping').\n         */\n        method: string;\n\n        /**\n         * Metadata from the original request.\n         */\n        _meta?: RequestMeta;\n\n        /**\n         * An abort signal used to communicate if the request was cancelled from the sender's side.\n         */\n        signal: AbortSignal;\n\n        /**\n         * Sends a request that relates to the current request being handled.\n         *\n         * This is used by certain transports to correctly associate related messages.\n         *\n         * For spec methods the result type is inferred from the method name.\n         * For custom (non-spec) methods, pass a result schema as the second argument.\n         */\n        send: {\n            <M extends RequestMethod>(\n                request: { method: M; params?: Record<string, unknown> },\n                options?: RequestOptions\n            ): Promise<ResultTypeMap[M]>;\n            <T extends StandardSchemaV1>(\n                request: Request,\n                resultSchema: T,\n                options?: RequestOptions\n            ): Promise<StandardSchemaV1.InferOutput<T>>;\n        };\n\n        /**\n         * Sends a notification that relates to the current request being handled.\n         *\n         * This is used by certain transports to correctly associate related messages.\n         */\n        notify: (notification: Notification) => Promise<void>;\n    };\n\n    /**\n     * HTTP transport information, only available when using an HTTP-based transport.\n     */\n    http?: {\n        /**\n         * Information about a validated access token, provided to request handlers.\n         */\n        authInfo?: AuthInfo;\n    };\n};\n\n/**\n * Context provided to server-side request handlers, extending {@linkcode BaseContext} with server-specific fields.\n */\nexport type ServerContext = BaseContext & {\n    mcpReq: {\n        /**\n         * Send a log message notification to the client.\n         * Respects the client's log level filter set via logging/setLevel.\n         *\n         * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).\n         * Remains functional during the deprecation window (at least twelve months).\n         * Migrate to stderr logging (STDIO servers) or OpenTelemetry.\n         */\n        log: (level: LoggingLevel, data: unknown, logger?: string) => Promise<void>;\n\n        /**\n         * Send an elicitation request to the client, requesting user input.\n         */\n        elicitInput: (params: ElicitRequestFormParams | ElicitRequestURLParams, options?: RequestOptions) => Promise<ElicitResult>;\n\n        /**\n         * Request LLM sampling from the client.\n         *\n         * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).\n         * Remains functional during the deprecation window (at least twelve months).\n         * Migrate to calling LLM provider APIs directly.\n         */\n        requestSampling: (\n            params: CreateMessageRequest['params'],\n            options?: RequestOptions\n        ) => Promise<CreateMessageResult | CreateMessageResultWithTools>;\n    };\n\n    http?: {\n        /**\n         * The original HTTP request.\n         */\n        req?: globalThis.Request;\n\n        /**\n         * Closes the SSE stream for this request, triggering client reconnection.\n         * Only available when using a StreamableHTTPServerTransport with eventStore configured.\n         */\n        closeSSE?: () => void;\n\n        /**\n         * Closes the standalone GET SSE stream, triggering client reconnection.\n         * Only available when using a StreamableHTTPServerTransport with eventStore configured.\n         */\n        closeStandaloneSSE?: () => void;\n    };\n};\n\n/**\n * Context provided to client-side request handlers.\n */\nexport type ClientContext = BaseContext;\n\n/**\n * Information about a request's timeout state\n */\ntype TimeoutInfo = {\n    timeoutId: ReturnType<typeof setTimeout>;\n    startTime: number;\n    timeout: number;\n    maxTotalTimeout?: number;\n    resetTimeoutOnProgress: boolean;\n    onTimeout: () => void;\n};\n\n/**\n * Implements MCP protocol framing on top of a pluggable transport, including\n * features like request/response linking, notifications, and progress.\n *\n * `Protocol` is abstract; `Client` and `Server` are the concrete role-specific\n * implementations most code should use.\n */\nexport abstract class Protocol<ContextT extends BaseContext> {\n    private _transport?: Transport;\n    private _requestMessageId = 0;\n    private _requestHandlers: Map<string, (request: JSONRPCRequest, ctx: ContextT) => Promise<Result>> = new Map();\n    private _requestHandlerAbortControllers: Map<RequestId, AbortController> = new Map();\n    private _notificationHandlers: Map<string, (notification: JSONRPCNotification) => Promise<void>> = new Map();\n    private _responseHandlers: Map<number, (response: JSONRPCResultResponse | Error) => void> = new Map();\n    private _progressHandlers: Map<number, ProgressCallback> = new Map();\n    private _timeoutInfo: Map<number, TimeoutInfo> = new Map();\n    private _pendingDebouncedNotifications = new Set<string>();\n\n    protected _supportedProtocolVersions: string[];\n\n    /**\n     * Callback for when the connection is closed for any reason.\n     *\n     * This is invoked when {@linkcode Protocol.close | close()} is called as well.\n     */\n    onclose?: () => void;\n\n    /**\n     * Callback for when an error occurs.\n     *\n     * Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band.\n     */\n    onerror?: (error: Error) => void;\n\n    /**\n     * A handler to invoke for any request types that do not have their own handler installed.\n     */\n    fallbackRequestHandler?: (request: JSONRPCRequest, ctx: ContextT) => Promise<Result>;\n\n    /**\n     * A handler to invoke for any notification types that do not have their own handler installed.\n     */\n    fallbackNotificationHandler?: (notification: Notification) => Promise<void>;\n\n    constructor(private _options?: ProtocolOptions) {\n        this._supportedProtocolVersions = _options?.supportedProtocolVersions ?? SUPPORTED_PROTOCOL_VERSIONS;\n\n        this.setNotificationHandler('notifications/cancelled', notification => {\n            this._oncancel(notification);\n        });\n\n        this.setNotificationHandler('notifications/progress', notification => {\n            this._onprogress(notification);\n        });\n\n        this.setRequestHandler(\n            'ping',\n            // Automatic pong by default.\n            _request => ({}) as Result\n        );\n    }\n\n    /**\n     * Builds the context object for request handlers. Subclasses must override\n     * to return the appropriate context type (e.g., ServerContext adds HTTP request info).\n     */\n    protected abstract buildContext(ctx: BaseContext, transportInfo?: MessageExtraInfo): ContextT;\n\n    private async _oncancel(notification: CancelledNotification): Promise<void> {\n        if (!notification.params.requestId) {\n            return;\n        }\n        // Handle request cancellation\n        const controller = this._requestHandlerAbortControllers.get(notification.params.requestId);\n        controller?.abort(notification.params.reason);\n    }\n\n    private _setupTimeout(\n        messageId: number,\n        timeout: number,\n        maxTotalTimeout: number | undefined,\n        onTimeout: () => void,\n        resetTimeoutOnProgress: boolean = false\n    ) {\n        this._timeoutInfo.set(messageId, {\n            timeoutId: setTimeout(onTimeout, timeout),\n            startTime: Date.now(),\n            timeout,\n            maxTotalTimeout,\n            resetTimeoutOnProgress,\n            onTimeout\n        });\n    }\n\n    private _resetTimeout(messageId: number): boolean {\n        const info = this._timeoutInfo.get(messageId);\n        if (!info) return false;\n\n        const totalElapsed = Date.now() - info.startTime;\n        if (info.maxTotalTimeout && totalElapsed >= info.maxTotalTimeout) {\n            this._timeoutInfo.delete(messageId);\n            throw new SdkError(SdkErrorCode.RequestTimeout, 'Maximum total timeout exceeded', {\n                maxTotalTimeout: info.maxTotalTimeout,\n                totalElapsed\n            });\n        }\n\n        clearTimeout(info.timeoutId);\n        info.timeoutId = setTimeout(info.onTimeout, info.timeout);\n        return true;\n    }\n\n    private _cleanupTimeout(messageId: number) {\n        const info = this._timeoutInfo.get(messageId);\n        if (info) {\n            clearTimeout(info.timeoutId);\n            this._timeoutInfo.delete(messageId);\n        }\n    }\n\n    /**\n     * Attaches to the given transport, starts it, and starts listening for messages.\n     *\n     * The caller assumes ownership of the {@linkcode Transport}, replacing any callbacks that have already been set, and expects that it is the only user of the {@linkcode Transport} instance going forward.\n     */\n    async connect(transport: Transport): Promise<void> {\n        this._transport = transport;\n        const _onclose = this.transport?.onclose;\n        this._transport.onclose = () => {\n            try {\n                _onclose?.();\n            } finally {\n                this._onclose();\n            }\n        };\n\n        const _onerror = this.transport?.onerror;\n        this._transport.onerror = (error: Error) => {\n            _onerror?.(error);\n            this._onerror(error);\n        };\n\n        const _onmessage = this._transport?.onmessage;\n        this._transport.onmessage = (message, extra) => {\n            _onmessage?.(message, extra);\n            if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) {\n                this._onresponse(message);\n            } else if (isJSONRPCRequest(message)) {\n                this._onrequest(message, extra);\n            } else if (isJSONRPCNotification(message)) {\n                this._onnotification(message);\n            } else {\n                this._onerror(new Error(`Unknown message type: ${JSON.stringify(message)}`));\n            }\n        };\n\n        // Pass supported protocol versions to transport for header validation\n        transport.setSupportedProtocolVersions?.(this._supportedProtocolVersions);\n\n        await this._transport.start();\n    }\n\n    private _onclose(): void {\n        const responseHandlers = this._responseHandlers;\n        this._responseHandlers = new Map();\n        this._progressHandlers.clear();\n        this._pendingDebouncedNotifications.clear();\n\n        for (const info of this._timeoutInfo.values()) {\n            clearTimeout(info.timeoutId);\n        }\n        this._timeoutInfo.clear();\n\n        const requestHandlerAbortControllers = this._requestHandlerAbortControllers;\n        this._requestHandlerAbortControllers = new Map();\n\n        const error = new SdkError(SdkErrorCode.ConnectionClosed, 'Connection closed');\n\n        this._transport = undefined;\n\n        try {\n            this.onclose?.();\n        } finally {\n            for (const handler of responseHandlers.values()) {\n                handler(error);\n            }\n\n            for (const controller of requestHandlerAbortControllers.values()) {\n                controller.abort(error);\n            }\n        }\n    }\n\n    private _onerror(error: Error): void {\n        this.onerror?.(error);\n    }\n\n    private _onnotification(notification: JSONRPCNotification): void {\n        const handler = this._notificationHandlers.get(notification.method) ?? this.fallbackNotificationHandler;\n\n        // Ignore notifications not being subscribed to.\n        if (handler === undefined) {\n            return;\n        }\n\n        // Starting with Promise.resolve() puts any synchronous errors into the monad as well.\n        Promise.resolve()\n            .then(() => handler(notification))\n            .catch(error => this._onerror(new Error(`Uncaught error in notification handler: ${error}`)));\n    }\n\n    private _onrequest(request: JSONRPCRequest, extra?: MessageExtraInfo): void {\n        const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;\n\n        // Capture the current transport at request time to ensure responses go to the correct client\n        const capturedTransport = this._transport;\n\n        const sendNotification = (notification: Notification, options?: NotificationOptions) =>\n            this.notification(notification, { ...options, relatedRequestId: request.id });\n        const sendRequest = <U extends StandardSchemaV1>(r: Request, resultSchema: U, options?: RequestOptions) =>\n            this._requestWithSchema(r, resultSchema, { ...options, relatedRequestId: request.id });\n\n        if (handler === undefined) {\n            const errorResponse: JSONRPCErrorResponse = {\n                jsonrpc: '2.0',\n                id: request.id,\n                error: {\n                    code: ProtocolErrorCode.MethodNotFound,\n                    message: 'Method not found'\n                }\n            };\n            capturedTransport?.send(errorResponse).catch(error => this._onerror(new Error(`Failed to send an error response: ${error}`)));\n            return;\n        }\n\n        const abortController = new AbortController();\n        this._requestHandlerAbortControllers.set(request.id, abortController);\n\n        const baseCtx: BaseContext = {\n            sessionId: capturedTransport?.sessionId,\n            mcpReq: {\n                id: request.id,\n                method: request.method,\n                _meta: request.params?._meta,\n                signal: abortController.signal,\n                // BaseContext.mcpReq.send is declared with two overloads (spec-method-keyed and explicit-schema). Arrow\n                // literals can't carry overload signatures, so the inferred single-signature type isn't assignable to\n                // that overloaded property type. The cast is sound: this impl dispatches both overload paths via the\n                // isStandardSchema guard, and sendRequest validates the result against the resolved schema either way.\n                send: ((r: Request, schemaOrOptions?: StandardSchemaV1 | RequestOptions, maybeOptions?: RequestOptions) => {\n                    if (isStandardSchema(schemaOrOptions)) {\n                        return sendRequest(r, schemaOrOptions, maybeOptions);\n                    }\n                    const resultSchema = getResultSchema(r.method);\n                    if (!resultSchema) {\n                        throw new TypeError(\n                            `'${r.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`\n                        );\n                    }\n                    return sendRequest(r, resultSchema, schemaOrOptions);\n                }) as BaseContext['mcpReq']['send'],\n                notify: sendNotification\n            },\n            http: extra?.authInfo ? { authInfo: extra.authInfo } : undefined\n        };\n        const ctx = this.buildContext(baseCtx, extra);\n\n        // Starting with Promise.resolve() puts any synchronous errors into the monad as well.\n        Promise.resolve()\n            .then(() => handler(request, ctx))\n            .then(\n                async result => {\n                    if (abortController.signal.aborted) {\n                        // Request was cancelled\n                        return;\n                    }\n\n                    const response: JSONRPCResponse = {\n                        result,\n                        jsonrpc: '2.0',\n                        id: request.id\n                    };\n                    await capturedTransport?.send(response);\n                },\n                async error => {\n                    if (abortController.signal.aborted) {\n                        // Request was cancelled\n                        return;\n                    }\n\n                    const errorResponse: JSONRPCErrorResponse = {\n                        jsonrpc: '2.0',\n                        id: request.id,\n                        error: {\n                            code: Number.isSafeInteger(error['code']) ? error['code'] : ProtocolErrorCode.InternalError,\n                            message: error.message ?? 'Internal error',\n                            ...(error['data'] !== undefined && { data: error['data'] })\n                        }\n                    };\n                    await capturedTransport?.send(errorResponse);\n                }\n            )\n            .catch(error => this._onerror(new Error(`Failed to send response: ${error}`)))\n            .finally(() => {\n                if (this._requestHandlerAbortControllers.get(request.id) === abortController) {\n                    this._requestHandlerAbortControllers.delete(request.id);\n                }\n            });\n    }\n\n    private _onprogress(notification: ProgressNotification): void {\n        const { progressToken, ...params } = notification.params;\n        const messageId = Number(progressToken);\n\n        const handler = this._progressHandlers.get(messageId);\n        if (!handler) {\n            this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(notification)}`));\n            return;\n        }\n\n        const responseHandler = this._responseHandlers.get(messageId);\n        const timeoutInfo = this._timeoutInfo.get(messageId);\n\n        if (timeoutInfo && responseHandler && timeoutInfo.resetTimeoutOnProgress) {\n            try {\n                this._resetTimeout(messageId);\n            } catch (error) {\n                // Clean up if maxTotalTimeout was exceeded\n                this._responseHandlers.delete(messageId);\n                this._progressHandlers.delete(messageId);\n                this._cleanupTimeout(messageId);\n                responseHandler(error as Error);\n                return;\n            }\n        }\n\n        handler(params);\n    }\n\n    private _onresponse(response: JSONRPCResponse | JSONRPCErrorResponse): void {\n        const messageId = Number(response.id);\n\n        const handler = this._responseHandlers.get(messageId);\n        if (handler === undefined) {\n            this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(response)}`));\n            return;\n        }\n\n        this._responseHandlers.delete(messageId);\n        this._cleanupTimeout(messageId);\n        this._progressHandlers.delete(messageId);\n\n        if (isJSONRPCResultResponse(response)) {\n            handler(response);\n        } else {\n            const error = ProtocolError.fromError(response.error.code, response.error.message, response.error.data);\n            handler(error);\n        }\n    }\n\n    get transport(): Transport | undefined {\n        return this._transport;\n    }\n\n    /**\n     * Closes the connection.\n     */\n    async close(): Promise<void> {\n        await this._transport?.close();\n    }\n\n    /**\n     * A method to check if a capability is supported by the remote side, for the given method to be called.\n     *\n     * This should be implemented by subclasses.\n     */\n    protected abstract assertCapabilityForMethod(method: RequestMethod | string): void;\n\n    /**\n     * A method to check if a notification is supported by the local side, for the given method to be sent.\n     *\n     * This should be implemented by subclasses.\n     */\n    protected abstract assertNotificationCapability(method: NotificationMethod | string): void;\n\n    /**\n     * A method to check if a request handler is supported by the local side, for the given method to be handled.\n     *\n     * This should be implemented by subclasses.\n     */\n    protected abstract assertRequestHandlerCapability(method: string): void;\n\n    /**\n     * Sends a request and waits for a response.\n     *\n     * For spec methods the result schema is resolved automatically from the method name\n     * and the return type is method-keyed. For custom (non-spec) methods, pass a\n     * `resultSchema` as the second argument; the response is validated against it and\n     * the return type is inferred from the schema.\n     *\n     * Do not use this method to emit notifications! Use {@linkcode Protocol.notification | notification()} instead.\n     */\n    request<M extends RequestMethod>(\n        request: { method: M; params?: Record<string, unknown> },\n        options?: RequestOptions\n    ): Promise<ResultTypeMap[M]>;\n    request<T extends StandardSchemaV1>(\n        request: Request,\n        resultSchema: T,\n        options?: RequestOptions\n    ): Promise<StandardSchemaV1.InferOutput<T>>;\n    request(request: Request, schemaOrOptions?: StandardSchemaV1 | RequestOptions, maybeOptions?: RequestOptions): Promise<unknown> {\n        if (isStandardSchema(schemaOrOptions)) {\n            return this._requestWithSchema(request, schemaOrOptions, maybeOptions);\n        }\n        const resultSchema = getResultSchema(request.method);\n        if (!resultSchema) {\n            throw new TypeError(`'${request.method}' is not a spec method; pass a result schema as the second argument to request().`);\n        }\n        return this._requestWithSchema(request, resultSchema, schemaOrOptions);\n    }\n\n    /**\n     * Sends a request and waits for a response, using the provided schema for validation.\n     *\n     * This is the internal implementation used by SDK methods that need to specify\n     * a particular result schema (e.g., for compatibility schemas).\n     */\n    protected _requestWithSchema<T extends StandardSchemaV1>(\n        request: Request,\n        resultSchema: T,\n        options?: RequestOptions\n    ): Promise<StandardSchemaV1.InferOutput<T>> {\n        const { relatedRequestId, resumptionToken, onresumptiontoken } = options ?? {};\n\n        let onAbort: (() => void) | undefined;\n        let cleanupMessageId: number | undefined;\n\n        // Send the request\n        return new Promise<StandardSchemaV1.InferOutput<T>>((resolve, reject) => {\n            const earlyReject = (error: unknown) => {\n                reject(error);\n            };\n\n            if (!this._transport) {\n                earlyReject(new Error('Not connected'));\n                return;\n            }\n\n            if (this._options?.enforceStrictCapabilities === true) {\n                try {\n                    this.assertCapabilityForMethod(request.method);\n                } catch (error) {\n                    earlyReject(error);\n                    return;\n                }\n            }\n\n            options?.signal?.throwIfAborted();\n\n            const messageId = this._requestMessageId++;\n            cleanupMessageId = messageId;\n            const jsonrpcRequest: JSONRPCRequest = {\n                ...request,\n                jsonrpc: '2.0',\n                id: messageId\n            };\n\n            if (options?.onprogress) {\n                this._progressHandlers.set(messageId, options.onprogress);\n                jsonrpcRequest.params = {\n                    ...request.params,\n                    _meta: {\n                        ...request.params?._meta,\n                        progressToken: messageId\n                    }\n                };\n            }\n\n            let responseReceived = false;\n\n            const cancel = (reason: unknown) => {\n                if (responseReceived) {\n                    return;\n                }\n                this._progressHandlers.delete(messageId);\n\n                this._transport\n                    ?.send(\n                        {\n                            jsonrpc: '2.0',\n                            method: 'notifications/cancelled',\n                            params: {\n                                requestId: messageId,\n                                reason: String(reason)\n                            }\n                        },\n                        { relatedRequestId, resumptionToken, onresumptiontoken }\n                    )\n                    .catch(error => this._onerror(new Error(`Failed to send cancellation: ${error}`)));\n\n                // Wrap the reason in an SdkError if it isn't already\n                const error = reason instanceof SdkError ? reason : new SdkError(SdkErrorCode.RequestTimeout, String(reason));\n                reject(error);\n            };\n\n            this._responseHandlers.set(messageId, response => {\n                if (options?.signal?.aborted) {\n                    return;\n                }\n                responseReceived = true;\n\n                if (response instanceof Error) {\n                    return reject(response);\n                }\n\n                validateStandardSchema(resultSchema, response.result).then(parseResult => {\n                    if (parseResult.success) {\n                        resolve(parseResult.data);\n                    } else {\n                        reject(new SdkError(SdkErrorCode.InvalidResult, `Invalid result for ${request.method}: ${parseResult.error}`));\n                    }\n                }, reject);\n            });\n\n            onAbort = () => cancel(options?.signal?.reason);\n            options?.signal?.addEventListener('abort', onAbort, { once: true });\n\n            const timeout = options?.timeout ?? DEFAULT_REQUEST_TIMEOUT_MSEC;\n            const timeoutHandler = () => cancel(new SdkError(SdkErrorCode.RequestTimeout, 'Request timed out', { timeout }));\n\n            this._setupTimeout(messageId, timeout, options?.maxTotalTimeout, timeoutHandler, options?.resetTimeoutOnProgress ?? false);\n\n            this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch(error => {\n                this._progressHandlers.delete(messageId);\n                reject(error);\n            });\n        }).finally(() => {\n            // Per-request cleanup that must run on every exit path. Consolidated\n            // here so new exit paths added to the promise body can't forget it.\n            // _progressHandlers is NOT cleaned up here: _onresponse deletes it\n            // on resolution, and error paths above delete it inline.\n            if (onAbort) {\n                options?.signal?.removeEventListener('abort', onAbort);\n            }\n            if (cleanupMessageId !== undefined) {\n                this._responseHandlers.delete(cleanupMessageId);\n                this._cleanupTimeout(cleanupMessageId);\n            }\n        });\n    }\n\n    /**\n     * Emits a notification, which is a one-way message that does not expect a response.\n     */\n    async notification(notification: Notification, options?: NotificationOptions): Promise<void> {\n        if (!this._transport) {\n            throw new SdkError(SdkErrorCode.NotConnected, 'Not connected');\n        }\n\n        this.assertNotificationCapability(notification.method);\n\n        const jsonrpcNotification: JSONRPCNotification = { jsonrpc: '2.0', ...notification };\n\n        const debouncedMethods = this._options?.debouncedNotificationMethods ?? [];\n        // A notification can only be debounced if it's in the list AND it's \"simple\"\n        // (i.e., has no parameters and no related request ID that could be lost).\n        const canDebounce = debouncedMethods.includes(notification.method) && !notification.params && !options?.relatedRequestId;\n\n        if (canDebounce) {\n            // If a notification of this type is already scheduled, do nothing.\n            if (this._pendingDebouncedNotifications.has(notification.method)) {\n                return;\n            }\n\n            // Mark this notification type as pending.\n            this._pendingDebouncedNotifications.add(notification.method);\n\n            // Schedule the actual send to happen in the next microtask.\n            // This allows all synchronous calls in the current event loop tick to be coalesced.\n            Promise.resolve().then(() => {\n                // Un-mark the notification so the next one can be scheduled.\n                this._pendingDebouncedNotifications.delete(notification.method);\n\n                // SAFETY CHECK: If the connection was closed while this was pending, abort.\n                if (!this._transport) {\n                    return;\n                }\n\n                // Send the notification, but don't await it here to avoid blocking.\n                // Handle potential errors with a .catch().\n                this._transport?.send(jsonrpcNotification, options).catch(error => this._onerror(error));\n            });\n\n            // Return immediately.\n            return;\n        }\n\n        await this._transport.send(jsonrpcNotification, options);\n    }\n\n    /**\n     * Registers a handler to invoke when this protocol object receives a request with the given method.\n     *\n     * Note that this will replace any previous request handler for the same method.\n     *\n     * For spec methods, pass `(method, handler)`; the request is parsed with the spec\n     * schema and the handler receives the typed `Request`. For custom (non-spec)\n     * methods, pass `(method, schemas, handler)`; `params` are validated against\n     * `schemas.params` and the handler receives the parsed params object directly.\n     * Supplying `schemas.result` types the handler's return value.\n     *\n     * @example Custom request method\n     * ```ts source=\"./protocol.examples.ts#Protocol_setRequestHandler_customMethod\"\n     * const SearchParams = z.object({ query: z.string(), limit: z.number().optional() });\n     * const SearchResult = z.object({ hits: z.array(z.string()) });\n     *\n     * protocol.setRequestHandler('acme/search', { params: SearchParams, result: SearchResult }, async (params, _ctx) => {\n     *     return { hits: [`result for ${params.query}`] };\n     * });\n     * ```\n     */\n    setRequestHandler<M extends RequestMethod>(\n        method: M,\n        handler: (request: RequestTypeMap[M], ctx: ContextT) => ResultTypeMap[M] | Promise<ResultTypeMap[M]>\n    ): void;\n    setRequestHandler<P extends StandardSchemaV1, R extends StandardSchemaV1 | undefined = undefined>(\n        method: string,\n        schemas: { params: P; result?: R },\n        handler: (params: StandardSchemaV1.InferOutput<P>, ctx: ContextT) => InferHandlerResult<R> | Promise<InferHandlerResult<R>>\n    ): void;\n    setRequestHandler(\n        method: string,\n        schemasOrHandler: RequestHandlerSchemas | ((request: unknown, ctx: ContextT) => Result | Promise<Result>),\n        maybeHandler?: (params: unknown, ctx: ContextT) => Result | Promise<Result>\n    ): void {\n        this.assertRequestHandlerCapability(method);\n\n        let stored: (request: JSONRPCRequest, ctx: ContextT) => Promise<Result>;\n\n        if (typeof schemasOrHandler === 'function') {\n            const schema = getRequestSchema(method);\n            if (!schema) {\n                throw new TypeError(\n                    `'${method}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`\n                );\n            }\n            stored = (request, ctx) => Promise.resolve(schemasOrHandler(schema.parse(request), ctx));\n        } else if (maybeHandler) {\n            stored = async (request, ctx) => {\n                const userParams = { ...request.params };\n                delete userParams._meta;\n                const parsed = await validateStandardSchema(schemasOrHandler.params, userParams);\n                if (!parsed.success) {\n                    throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Invalid params for ${method}: ${parsed.error}`);\n                }\n                return maybeHandler(parsed.data, ctx);\n            };\n        } else {\n            throw new TypeError('setRequestHandler: handler is required');\n        }\n\n        this._requestHandlers.set(method, this._wrapHandler(method, stored));\n    }\n\n    /**\n     * Hook for subclasses to wrap a registered request handler with role-specific\n     * validation or behavior (e.g. `Server` validates `tools/call` results, `Client`\n     * validates `elicitation/create` mode and result). Runs for both the 2-arg and\n     * 3-arg registration paths. The default implementation is identity.\n     *\n     * Subclasses overriding this hook avoid redeclaring `setRequestHandler`'s overload set.\n     */\n    protected _wrapHandler(\n        _method: string,\n        handler: (request: JSONRPCRequest, ctx: ContextT) => Promise<Result>\n    ): (request: JSONRPCRequest, ctx: ContextT) => Promise<Result> {\n        return handler;\n    }\n\n    /**\n     * Removes the request handler for the given method.\n     */\n    removeRequestHandler(method: RequestMethod | string): void {\n        this._requestHandlers.delete(method);\n    }\n\n    /**\n     * Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.\n     */\n    assertCanSetRequestHandler(method: RequestMethod | string): void {\n        if (this._requestHandlers.has(method)) {\n            throw new Error(`A request handler for ${method} already exists, which would be overridden`);\n        }\n    }\n\n    /**\n     * Registers a handler to invoke when this protocol object receives a notification with the given method.\n     *\n     * Note that this will replace any previous notification handler for the same method.\n     *\n     * For spec methods, pass `(method, handler)`; the notification is parsed with the\n     * spec schema. For custom (non-spec) methods, pass `(method, schemas, handler)`;\n     * `params` are validated against `schemas.params` and the handler receives the\n     * parsed params object directly. The raw notification is passed as the second\n     * argument; `_meta` is recoverable via `notification.params?._meta`.\n     */\n    setNotificationHandler<M extends NotificationMethod>(\n        method: M,\n        handler: (notification: NotificationTypeMap[M]) => void | Promise<void>\n    ): void;\n    setNotificationHandler<P extends StandardSchemaV1>(\n        method: string,\n        schemas: { params: P },\n        handler: (params: StandardSchemaV1.InferOutput<P>, notification: Notification) => void | Promise<void>\n    ): void;\n    setNotificationHandler(\n        method: string,\n        schemasOrHandler: { params: StandardSchemaV1 } | ((notification: unknown) => void | Promise<void>),\n        maybeHandler?: (params: unknown, notification: Notification) => void | Promise<void>\n    ): void {\n        if (typeof schemasOrHandler === 'function') {\n            const schema = getNotificationSchema(method);\n            if (!schema) {\n                throw new TypeError(\n                    `'${method}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`\n                );\n            }\n            this._notificationHandlers.set(method, notification => Promise.resolve(schemasOrHandler(schema.parse(notification))));\n            return;\n        }\n\n        if (!maybeHandler) {\n            throw new TypeError('setNotificationHandler: handler is required');\n        }\n        this._notificationHandlers.set(method, async notification => {\n            const userParams = { ...notification.params };\n            delete userParams._meta;\n            const parsed = await validateStandardSchema(schemasOrHandler.params, userParams);\n            if (!parsed.success) {\n                throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Invalid params for notification ${method}: ${parsed.error}`);\n            }\n            await maybeHandler(parsed.data, notification);\n        });\n    }\n\n    /**\n     * Removes the notification handler for the given method.\n     */\n    removeNotificationHandler(method: NotificationMethod | string): void {\n        this._notificationHandlers.delete(method);\n    }\n}\n\n/**\n * Schema bundle accepted by {@linkcode Protocol.setRequestHandler | setRequestHandler}'s 3-arg form.\n *\n * `params` is required and validates the inbound `request.params`. `result` is optional;\n * when supplied it types the handler's return value (no runtime validation is performed\n * on the result).\n */\nexport interface RequestHandlerSchemas<\n    P extends StandardSchemaV1 = StandardSchemaV1,\n    R extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined\n> {\n    params: P;\n    result?: R;\n}\n\ntype InferHandlerResult<R extends StandardSchemaV1 | undefined> = R extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<R> : Result;\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n    return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nexport function mergeCapabilities(base: ServerCapabilities, additional: Partial<ServerCapabilities>): ServerCapabilities;\nexport function mergeCapabilities(base: ClientCapabilities, additional: Partial<ClientCapabilities>): ClientCapabilities;\nexport function mergeCapabilities<T extends ServerCapabilities | ClientCapabilities>(base: T, additional: Partial<T>): T {\n    const result: T = { ...base };\n    for (const key in additional) {\n        const k = key as keyof T;\n        const addValue = additional[k];\n        if (addValue === undefined) continue;\n        const baseValue = result[k];\n        result[k] =\n            isPlainObject(baseValue) && isPlainObject(addValue)\n                ? ({ ...(baseValue as Record<string, unknown>), ...(addValue as Record<string, unknown>) } as T[typeof k])\n                : (addValue as T[typeof k]);\n    }\n    return result;\n}\n","import type { JSONRPCMessage } from '../types/index';\nimport { JSONRPCMessageSchema } from '../types/index';\n\nexport const STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;\n\n/**\n * Buffers a continuous stdio stream into discrete JSON-RPC messages.\n */\nexport class ReadBuffer {\n    private _buffer?: Buffer;\n    private _maxBufferSize: number;\n\n    constructor(options?: { maxBufferSize?: number }) {\n        this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;\n    }\n\n    append(chunk: Buffer): void {\n        const newSize = (this._buffer?.length ?? 0) + chunk.length;\n        if (newSize > this._maxBufferSize) {\n            this.clear();\n            throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);\n        }\n        this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;\n    }\n\n    readMessage(): JSONRPCMessage | null {\n        while (this._buffer) {\n            const index = this._buffer.indexOf('\\n');\n            if (index === -1) {\n                return null;\n            }\n\n            const line = this._buffer.toString('utf8', 0, index).replace(/\\r$/, '');\n            this._buffer = this._buffer.subarray(index + 1);\n\n            try {\n                return deserializeMessage(line);\n            } catch (error) {\n                // Skip non-JSON lines (e.g., debug output from hot-reload tools like\n                // tsx or nodemon that write to stdout). Schema validation errors still\n                // throw so malformed-but-valid-JSON messages surface via onerror.\n                if (error instanceof SyntaxError) {\n                    continue;\n                }\n                throw error;\n            }\n        }\n        return null;\n    }\n\n    clear(): void {\n        this._buffer = undefined;\n    }\n}\n\nexport function deserializeMessage(line: string): JSONRPCMessage {\n    return JSONRPCMessageSchema.parse(JSON.parse(line));\n}\n\nexport function serializeMessage(message: JSONRPCMessage): string {\n    return JSON.stringify(message) + '\\n';\n}\n","/**\n * Tool name validation utilities according to SEP: Specify Format for Tool Names\n *\n * Tool names SHOULD be between 1 and 128 characters in length (inclusive).\n * Tool names are case-sensitive.\n * Allowed characters: uppercase and lowercase ASCII letters (`A-Z`, `a-z`), digits\n * (`0-9`), underscore (`_`), dash (`-`), and dot (`.`).\n * Tool names SHOULD NOT contain spaces, commas, or other special characters.\n *\n * @see {@link https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986 | SEP-986: Specify Format for Tool Names}\n */\n\n/**\n * Regular expression for valid tool names according to SEP-986 specification\n */\nconst TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;\n\n/**\n * Validates a tool name according to the SEP specification\n * @param name - The tool name to validate\n * @returns An object containing validation result and any warnings\n */\nexport function validateToolName(name: string): {\n    isValid: boolean;\n    warnings: string[];\n} {\n    const warnings: string[] = [];\n\n    // Check length\n    if (name.length === 0) {\n        return {\n            isValid: false,\n            warnings: ['Tool name cannot be empty']\n        };\n    }\n\n    if (name.length > 128) {\n        return {\n            isValid: false,\n            warnings: [`Tool name exceeds maximum length of 128 characters (current: ${name.length})`]\n        };\n    }\n\n    // Check for specific problematic patterns (these are warnings, not validation failures)\n    if (name.includes(' ')) {\n        warnings.push('Tool name contains spaces, which may cause parsing issues');\n    }\n\n    if (name.includes(',')) {\n        warnings.push('Tool name contains commas, which may cause parsing issues');\n    }\n\n    // Check for potentially confusing patterns (leading/trailing dashes, dots, slashes)\n    if (name.startsWith('-') || name.endsWith('-')) {\n        warnings.push('Tool name starts or ends with a dash, which may cause parsing issues in some contexts');\n    }\n\n    if (name.startsWith('.') || name.endsWith('.')) {\n        warnings.push('Tool name starts or ends with a dot, which may cause parsing issues in some contexts');\n    }\n\n    // Check for invalid characters\n    if (!TOOL_NAME_REGEX.test(name)) {\n        const invalidChars = [...name]\n            .filter(char => !/[A-Za-z0-9._-]/.test(char))\n            .filter((char, index, arr) => arr.indexOf(char) === index); // Remove duplicates\n\n        warnings.push(\n            `Tool name contains invalid characters: ${invalidChars.map(c => `\"${c}\"`).join(', ')}`,\n            'Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)'\n        );\n\n        return {\n            isValid: false,\n            warnings\n        };\n    }\n\n    return {\n        isValid: true,\n        warnings\n    };\n}\n\n/**\n * Issues warnings for non-conforming tool names\n * @param name - The tool name that triggered the warnings\n * @param warnings - Array of warning messages\n */\nexport function issueToolNameWarning(name: string, warnings: string[]): void {\n    if (warnings.length > 0) {\n        console.warn(`Tool name validation warning for \"${name}\":`);\n        for (const warning of warnings) {\n            console.warn(`  - ${warning}`);\n        }\n        console.warn('Tool registration will proceed, but this may cause compatibility issues.');\n        console.warn('Consider updating the tool name to conform to the MCP tool naming standard.');\n        console.warn(\n            'See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.'\n        );\n    }\n}\n\n/**\n * Validates a tool name and issues warnings for non-conforming names\n * @param name - The tool name to validate\n * @returns `true` if the name is valid, `false` otherwise\n */\nexport function validateAndWarnToolName(name: string): boolean {\n    const result = validateToolName(name);\n\n    // Always issue warnings for any validation issues (both invalid names and warnings)\n    issueToolNameWarning(name, result.warnings);\n\n    return result.isValid;\n}\n","import type { JSONRPCMessage, MessageExtraInfo, RequestId } from '../types/index';\n\nexport type FetchLike = (url: string | URL, init?: RequestInit) => Promise<Response>;\n\n/**\n * Normalizes `HeadersInit` to a plain `Record<string, string>` for manipulation.\n * Handles `Headers` objects, arrays of tuples, and plain objects.\n */\nexport function normalizeHeaders(headers: RequestInit['headers'] | undefined): Record<string, string> {\n    if (!headers) return {};\n\n    if (headers instanceof Headers) {\n        return Object.fromEntries(headers.entries());\n    }\n\n    if (Array.isArray(headers)) {\n        return Object.fromEntries(headers);\n    }\n\n    return { ...(headers as Record<string, string>) };\n}\n\n/**\n * Creates a fetch function that includes base `RequestInit` options.\n * This ensures requests inherit settings like credentials, mode, headers, etc. from the base init.\n *\n * @param baseFetch - The base fetch function to wrap (defaults to global `fetch`)\n * @param baseInit - The base `RequestInit` to merge with each request\n * @returns A wrapped fetch function that merges base options with call-specific options\n */\nexport function createFetchWithInit(baseFetch: FetchLike = fetch, baseInit?: RequestInit): FetchLike {\n    if (!baseInit) {\n        return baseFetch;\n    }\n\n    // Return a wrapped fetch that merges base RequestInit with call-specific init\n    return async (url: string | URL, init?: RequestInit): Promise<Response> => {\n        const mergedInit: RequestInit = {\n            ...baseInit,\n            ...init,\n            // Headers need special handling - merge instead of replace\n            headers: init?.headers ? { ...normalizeHeaders(baseInit.headers), ...normalizeHeaders(init.headers) } : baseInit.headers\n        };\n        return baseFetch(url, mergedInit);\n    };\n}\n\n/**\n * Options for sending a JSON-RPC message.\n */\nexport type TransportSendOptions = {\n    /**\n     * If present, `relatedRequestId` is used to indicate to the transport which incoming request to associate this outgoing message with.\n     */\n    relatedRequestId?: RequestId | undefined;\n\n    /**\n     * The resumption token used to continue long-running requests that were interrupted.\n     *\n     * This allows clients to reconnect and continue from where they left off, if supported by the transport.\n     */\n    resumptionToken?: string | undefined;\n\n    /**\n     * A callback that is invoked when the resumption token changes, if supported by the transport.\n     *\n     * This allows clients to persist the latest token for potential reconnection.\n     */\n    onresumptiontoken?: ((token: string) => void) | undefined;\n};\n/**\n * Describes the minimal contract for an MCP transport that a client or server can communicate over.\n */\nexport interface Transport {\n    /**\n     * Starts processing messages on the transport, including any connection steps that might need to be taken.\n     *\n     * This method should only be called after callbacks are installed, or else messages may be lost.\n     *\n     * NOTE: This method should not be called explicitly when using {@linkcode @modelcontextprotocol/client!client/client.Client | Client} or {@linkcode @modelcontextprotocol/server!server/server.Server | Server} classes, as they will implicitly call {@linkcode Transport.start | start()}.\n     */\n    start(): Promise<void>;\n\n    /**\n     * Sends a JSON-RPC message (request or response).\n     *\n     * If present, `relatedRequestId` is used to indicate to the transport which incoming request to associate this outgoing message with.\n     */\n    send(message: JSONRPCMessage, options?: TransportSendOptions): Promise<void>;\n\n    /**\n     * Closes the connection.\n     */\n    close(): Promise<void>;\n\n    /**\n     * Callback for when the connection is closed for any reason.\n     *\n     * This should be invoked when {@linkcode Transport.close | close()} is called as well.\n     */\n    onclose?: (() => void) | undefined;\n\n    /**\n     * Callback for when an error occurs.\n     *\n     * Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band.\n     */\n    onerror?: ((error: Error) => void) | undefined;\n\n    /**\n     * Callback for when a message (request or response) is received over the connection.\n     *\n     * Includes the {@linkcode MessageExtraInfo.request | request} and {@linkcode MessageExtraInfo.authInfo | authInfo} if the transport is authenticated.\n     *\n     * The {@linkcode MessageExtraInfo.request | request} can be used to get the original request information (headers, etc.)\n     */\n    onmessage?: (<T extends JSONRPCMessage>(message: T, extra?: MessageExtraInfo) => void) | undefined;\n\n    /**\n     * The session ID generated for this connection.\n     */\n    sessionId?: string | undefined;\n\n    /**\n     * Sets the protocol version used for the connection (called when the initialize response is received).\n     */\n    setProtocolVersion?: ((version: string) => void) | undefined;\n\n    /**\n     * Sets the supported protocol versions for header validation (called during connect).\n     * This allows the server to pass its supported versions to the transport.\n     */\n    setSupportedProtocolVersions?: ((versions: string[]) => void) | undefined;\n}\n","// Claude-authored implementation of RFC 6570 URI Templates\n\nexport type Variables = Record<string, string | string[]>;\n\nconst MAX_TEMPLATE_LENGTH = 1_000_000; // 1MB\nconst MAX_VARIABLE_LENGTH = 1_000_000; // 1MB\nconst MAX_TEMPLATE_EXPRESSIONS = 10_000;\nconst MAX_REGEX_LENGTH = 1_000_000; // 1MB\n\nexport class UriTemplate {\n    /**\n     * Returns true if the given string contains any URI template expressions.\n     * A template expression is a sequence of characters enclosed in curly braces,\n     * like `{foo}` or `{?bar}`.\n     */\n    static isTemplate(str: string): boolean {\n        // Look for any sequence of characters between curly braces\n        // that isn't just whitespace\n        return /\\{[^}\\s]+\\}/.test(str);\n    }\n\n    private static validateLength(str: string, max: number, context: string): void {\n        if (str.length > max) {\n            throw new Error(`${context} exceeds maximum length of ${max} characters (got ${str.length})`);\n        }\n    }\n    private readonly template: string;\n    private readonly parts: Array<string | { name: string; operator: string; names: string[]; exploded: boolean }>;\n\n    get variableNames(): string[] {\n        return this.parts.flatMap(part => (typeof part === 'string' ? [] : part.names));\n    }\n\n    constructor(template: string) {\n        UriTemplate.validateLength(template, MAX_TEMPLATE_LENGTH, 'Template');\n        this.template = template;\n        this.parts = this.parse(template);\n    }\n\n    toString(): string {\n        return this.template;\n    }\n\n    private parse(template: string): Array<string | { name: string; operator: string; names: string[]; exploded: boolean }> {\n        const parts: Array<string | { name: string; operator: string; names: string[]; exploded: boolean }> = [];\n        let currentText = '';\n        let i = 0;\n        let expressionCount = 0;\n\n        while (i < template.length) {\n            if (template[i] === '{') {\n                if (currentText) {\n                    parts.push(currentText);\n                    currentText = '';\n                }\n                const end = template.indexOf('}', i);\n                if (end === -1) throw new Error('Unclosed template expression');\n\n                expressionCount++;\n                if (expressionCount > MAX_TEMPLATE_EXPRESSIONS) {\n                    throw new Error(`Template contains too many expressions (max ${MAX_TEMPLATE_EXPRESSIONS})`);\n                }\n\n                const expr = template.slice(i + 1, end);\n                const operator = this.getOperator(expr);\n                const exploded = expr.includes('*');\n                const names = this.getNames(expr);\n                const name = names[0]!;\n\n                // Validate variable name length\n                for (const name of names) {\n                    UriTemplate.validateLength(name, MAX_VARIABLE_LENGTH, 'Variable name');\n                }\n\n                parts.push({ name, operator, names, exploded });\n                i = end + 1;\n            } else {\n                currentText += template[i];\n                i++;\n            }\n        }\n\n        if (currentText) {\n            parts.push(currentText);\n        }\n\n        return parts;\n    }\n\n    private getOperator(expr: string): string {\n        const operators = ['+', '#', '.', '/', '?', '&'];\n        return operators.find(op => expr.startsWith(op)) || '';\n    }\n\n    private getNames(expr: string): string[] {\n        const operator = this.getOperator(expr);\n        return expr\n            .slice(operator.length)\n            .split(',')\n            .map(name => name.replace('*', '').trim())\n            .filter(name => name.length > 0);\n    }\n\n    private encodeValue(value: string, operator: string): string {\n        UriTemplate.validateLength(value, MAX_VARIABLE_LENGTH, 'Variable value');\n        if (operator === '+' || operator === '#') {\n            return encodeURI(value);\n        }\n        return encodeURIComponent(value);\n    }\n\n    private expandPart(\n        part: {\n            name: string;\n            operator: string;\n            names: string[];\n            exploded: boolean;\n        },\n        variables: Variables\n    ): string {\n        if (part.operator === '?' || part.operator === '&') {\n            const pairs = part.names\n                .map(name => {\n                    const value = variables[name];\n                    if (value === undefined) return '';\n                    const encoded = Array.isArray(value)\n                        ? value.map(v => this.encodeValue(v, part.operator)).join(',')\n                        : this.encodeValue(value.toString(), part.operator);\n                    return `${name}=${encoded}`;\n                })\n                .filter(pair => pair.length > 0);\n\n            if (pairs.length === 0) return '';\n            const separator = part.operator === '?' ? '?' : '&';\n            return separator + pairs.join('&');\n        }\n\n        if (part.names.length > 1) {\n            const values = part.names.map(name => variables[name]).filter(v => v !== undefined);\n            if (values.length === 0) return '';\n            return values.map(v => (Array.isArray(v) ? v[0] : v)).join(',');\n        }\n\n        const value = variables[part.name];\n        if (value === undefined) return '';\n\n        const values = Array.isArray(value) ? value : [value];\n        const encoded = values.map(v => this.encodeValue(v, part.operator));\n\n        switch (part.operator) {\n            case '': {\n                return encoded.join(',');\n            }\n            case '+': {\n                return encoded.join(',');\n            }\n            case '#': {\n                return '#' + encoded.join(',');\n            }\n            case '.': {\n                return '.' + encoded.join('.');\n            }\n            case '/': {\n                return '/' + encoded.join('/');\n            }\n            default: {\n                return encoded.join(',');\n            }\n        }\n    }\n\n    expand(variables: Variables): string {\n        let result = '';\n        let hasQueryParam = false;\n\n        for (const part of this.parts) {\n            if (typeof part === 'string') {\n                result += part;\n                continue;\n            }\n\n            const expanded = this.expandPart(part, variables);\n            if (!expanded) continue;\n\n            // Convert ? to & if we already have a query parameter\n            result += (part.operator === '?' || part.operator === '&') && hasQueryParam ? expanded.replace('?', '&') : expanded;\n\n            if (part.operator === '?' || part.operator === '&') {\n                hasQueryParam = true;\n            }\n        }\n\n        return result;\n    }\n\n    private escapeRegExp(str: string): string {\n        return str.replaceAll(/[.*+?^${}()|[\\]\\\\]/g, String.raw`\\$&`);\n    }\n\n    private partToRegExp(part: {\n        name: string;\n        operator: string;\n        names: string[];\n        exploded: boolean;\n    }): Array<{ pattern: string; name: string }> {\n        const patterns: Array<{ pattern: string; name: string }> = [];\n\n        // Validate variable name length for matching\n        for (const name of part.names) {\n            UriTemplate.validateLength(name, MAX_VARIABLE_LENGTH, 'Variable name');\n        }\n\n        if (part.operator === '?' || part.operator === '&') {\n            for (let i = 0; i < part.names.length; i++) {\n                const name = part.names[i]!;\n                const prefix = i === 0 ? '\\\\' + part.operator : '&';\n                patterns.push({\n                    pattern: prefix + this.escapeRegExp(name) + '=([^&]+)',\n                    name\n                });\n            }\n            return patterns;\n        }\n\n        let pattern: string;\n        const name = part.name;\n\n        switch (part.operator) {\n            case '': {\n                pattern = part.exploded ? '([^/,]+(?:,[^/,]+)*)' : '([^/,]+)';\n                break;\n            }\n            case '+':\n            case '#': {\n                pattern = '(.+)';\n                break;\n            }\n            case '.': {\n                pattern = String.raw`\\.([^/,]+)`;\n                break;\n            }\n            case '/': {\n                pattern = '/' + (part.exploded ? '([^/,]+(?:,[^/,]+)*)' : '([^/,]+)');\n                break;\n            }\n            default: {\n                pattern = '([^/]+)';\n            }\n        }\n\n        patterns.push({ pattern, name });\n        return patterns;\n    }\n\n    match(uri: string): Variables | null {\n        UriTemplate.validateLength(uri, MAX_TEMPLATE_LENGTH, 'URI');\n        let pattern = '^';\n        const names: Array<{ name: string; exploded: boolean }> = [];\n\n        for (const part of this.parts) {\n            if (typeof part === 'string') {\n                pattern += this.escapeRegExp(part);\n            } else {\n                const patterns = this.partToRegExp(part);\n                for (const { pattern: partPattern, name } of patterns) {\n                    pattern += partPattern;\n                    names.push({ name, exploded: part.exploded });\n                }\n            }\n        }\n\n        pattern += '$';\n        UriTemplate.validateLength(pattern, MAX_REGEX_LENGTH, 'Generated regex pattern');\n        const regex = new RegExp(pattern);\n        const match = uri.match(regex);\n\n        if (!match) return null;\n\n        const result: Variables = {};\n        for (const [i, name_] of names.entries()) {\n            const { name, exploded } = name_!;\n            const value = match[i + 1]!;\n            const cleanName = name.replace('*', '');\n\n            result[cleanName] = exploded && value.includes(',') ? value.split(',') : value;\n        }\n\n        return result;\n    }\n}\n","import { SdkError, SdkErrorCode } from '../errors/sdkErrors';\nimport type { Transport } from '../shared/transport';\nimport type { AuthInfo, JSONRPCMessage, RequestId } from '../types/index';\n\ninterface QueuedMessage {\n    message: JSONRPCMessage;\n    extra?: { authInfo?: AuthInfo };\n}\n\n/**\n * In-memory transport for creating clients and servers that talk to each other within the same process.\n *\n * Intended for testing and development. For production in-process connections, use\n * `StreamableHTTPClientTransport` against a local server URL.\n */\nexport class InMemoryTransport implements Transport {\n    private _otherTransport?: InMemoryTransport;\n    private _messageQueue: QueuedMessage[] = [];\n    private _closed = false;\n\n    onclose?: () => void;\n    onerror?: (error: Error) => void;\n    onmessage?: (message: JSONRPCMessage, extra?: { authInfo?: AuthInfo }) => void;\n    sessionId?: string;\n\n    /**\n     * Creates a pair of linked in-memory transports that can communicate with each other. One should be passed to a {@linkcode @modelcontextprotocol/client!client/client.Client | Client} and one to a {@linkcode @modelcontextprotocol/server!server/server.Server | Server}.\n     */\n    static createLinkedPair(): [InMemoryTransport, InMemoryTransport] {\n        const clientTransport = new InMemoryTransport();\n        const serverTransport = new InMemoryTransport();\n        clientTransport._otherTransport = serverTransport;\n        serverTransport._otherTransport = clientTransport;\n        return [clientTransport, serverTransport];\n    }\n\n    async start(): Promise<void> {\n        // Process any messages that were queued before start was called\n        while (this._messageQueue.length > 0) {\n            const queuedMessage = this._messageQueue.shift()!;\n            this.onmessage?.(queuedMessage.message, queuedMessage.extra);\n        }\n    }\n\n    async close(): Promise<void> {\n        if (this._closed) return;\n        this._closed = true;\n\n        const other = this._otherTransport;\n        this._otherTransport = undefined;\n        try {\n            await other?.close();\n        } finally {\n            this.onclose?.();\n        }\n    }\n\n    /**\n     * Sends a message with optional auth info.\n     * This is useful for testing authentication scenarios.\n     */\n    async send(message: JSONRPCMessage, options?: { relatedRequestId?: RequestId; authInfo?: AuthInfo }): Promise<void> {\n        if (!this._otherTransport) {\n            throw new SdkError(SdkErrorCode.NotConnected, 'Not connected');\n        }\n\n        if (this._otherTransport.onmessage) {\n            this._otherTransport.onmessage(message, { authInfo: options?.authInfo });\n        } else {\n            this._otherTransport._messageQueue.push({ message, extra: { authInfo: options?.authInfo } });\n        }\n    }\n}\n","/**\n * Internal Zod schema utilities for protocol handling.\n * These are used internally by the SDK for protocol message validation.\n */\n\nimport * as z from 'zod/v4';\n\n/**\n * Base type for any Zod schema.\n */\nexport type AnySchema = z.core.$ZodType;\n\n/**\n * A Zod schema for objects specifically.\n */\nexport type AnyObjectSchema = z.core.$ZodObject;\n\n/**\n * Extracts the output type from a Zod schema.\n */\nexport type SchemaOutput<T extends AnySchema> = z.output<T>;\n\n/**\n * Parses data against a Zod schema (synchronous).\n * Returns a discriminated union with success/error.\n */\nexport function parseSchema<T extends AnySchema>(\n    schema: T,\n    data: unknown\n): { success: true; data: z.output<T> } | { success: false; error: z.core.$ZodError } {\n    return z.safeParse(schema, data);\n}\n","/**\n * Zod-specific helpers for the v1-compat raw-shape shorthand on\n * `registerTool`/`registerPrompt`. Kept separate from `standardSchema.ts` so\n * that file stays library-agnostic per the Standard Schema spec.\n */\n\nimport * as z from 'zod/v4';\n\nimport type { StandardSchemaWithJSON } from './standardSchema';\nimport { isStandardSchema } from './standardSchema';\n\nfunction isZodV4Schema(v: unknown): v is z.ZodType {\n    // `_zod` is the v4 internal namespace property. Zod v3 schemas have `_def`\n    // and (since 3.24) `~standard.vendor === 'zod'`, but never `_zod`. We require\n    // v4 because the wrap path below uses v4's `z.object()`, which cannot consume\n    // v3 field schemas.\n    return typeof v === 'object' && v !== null && '_zod' in v;\n}\n\nfunction looksLikeZodV3(v: unknown): boolean {\n    // v3 schemas have `_def.typeName` (e.g. 'ZodString') and no `_zod`.\n    return (\n        typeof v === 'object' &&\n        v !== null &&\n        !('_zod' in v) &&\n        '_def' in v &&\n        typeof (v as { _def?: { typeName?: unknown } })._def?.typeName === 'string'\n    );\n}\n\n/**\n * Detects a \"raw shape\" — a plain object whose values are Zod field schemas,\n * e.g. `{ name: z.string() }`. Powers the auto-wrap in\n * {@linkcode normalizeRawShapeSchema}, which wraps with `z.object()`, so only\n * Zod values are supported.\n *\n * @internal\n */\nexport function isZodRawShape(obj: unknown): obj is Record<string, z.ZodType> {\n    if (typeof obj !== 'object' || obj === null) return false;\n    if (isStandardSchema(obj)) return false;\n    // Require a plain object literal: rejects arrays, Date, Map, RegExp, class instances, etc.\n    // Object.create(null) is also accepted.\n    const proto = Object.getPrototypeOf(obj);\n    if (proto !== Object.prototype && proto !== null) return false;\n    // [].every() is true, so an empty plain object is a valid raw shape (matches v1).\n    return Object.values(obj).every(v => isZodV4Schema(v));\n}\n\n/**\n * Accepts either a {@linkcode StandardSchemaWithJSON} or a raw Zod shape\n * `{ field: z.string() }` and returns a {@linkcode StandardSchemaWithJSON}.\n * Raw shapes are wrapped with `z.object()` so the rest of the pipeline sees a\n * uniform schema type; already-wrapped schemas pass through unchanged.\n *\n * @internal\n */\nexport function normalizeRawShapeSchema(\n    schema: StandardSchemaWithJSON | Record<string, z.ZodType> | undefined\n): StandardSchemaWithJSON | undefined {\n    if (schema === undefined) return undefined;\n    if (isZodRawShape(schema)) {\n        return z.object(schema) as StandardSchemaWithJSON;\n    }\n    if (typeof schema === 'object' && schema !== null && !isStandardSchema(schema) && Object.values(schema).some(v => looksLikeZodV3(v))) {\n        throw new TypeError(\n            'Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.'\n        );\n    }\n    if (!isStandardSchema(schema)) {\n        throw new TypeError(\n            'inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).'\n        );\n    }\n    // Any StandardSchema passes through; standardSchemaToJsonSchema owns the per-vendor\n    // handling for schemas without `~standard.jsonSchema` (zod 4.0-4.1 fallback, zod 3\n    // and non-zod errors). Gating on `~standard.jsonSchema` here would unreachably\n    // front-run that fallback.\n    return schema;\n}\n","import type { StandardSchemaV1, StandardSchemaWithJSON } from '../util/standardSchema';\nimport type { JsonSchemaType, jsonSchemaValidator } from './types';\n\n/**\n * Wrap a raw JSON Schema object as a {@linkcode StandardSchemaWithJSON} so it can be\n * passed to `registerTool` / `registerPrompt`. Use this when you already have JSON\n * Schema (e.g. from TypeBox, or hand-written) and want to register it without going\n * through a Standard Schema library.\n *\n * The callback arguments will be typed `unknown` (raw JSON Schema has no TypeScript\n * types attached). Cast at the call site, or use the generic `fromJsonSchema<MyType>(...)`.\n *\n * @param schema - A JSON Schema object describing the expected shape\n * @param validator - A validator provider. When importing `fromJsonSchema` from\n *   `@modelcontextprotocol/server` or `@modelcontextprotocol/client`, a runtime-appropriate\n *   default is provided automatically (AJV on Node.js, CfWorker on edge runtimes).\n *\n * @example\n * ```ts source=\"./fromJsonSchema.examples.ts#fromJsonSchema_basicUsage\"\n * const inputSchema = fromJsonSchema<{ name: string }>(\n *     { type: 'object', properties: { name: { type: 'string' } }, required: ['name'] },\n *     validator\n * );\n * // Use with server.registerTool('greet', { inputSchema }, handler)\n * ```\n */\nexport function fromJsonSchema<T = unknown>(schema: JsonSchemaType, validator: jsonSchemaValidator): StandardSchemaWithJSON<T, T> {\n    const check = validator.getValidator<T>(schema);\n    return {\n        '~standard': {\n            version: 1,\n            vendor: 'mcp',\n            jsonSchema: {\n                input: () => schema as Record<string, unknown>,\n                output: () => schema as Record<string, unknown>\n            },\n            validate: (data: unknown): StandardSchemaV1.Result<T> => {\n                const result = check(data);\n                return result.valid ? { value: result.data } : { issues: [{ message: result.errorMessage }] };\n            }\n        }\n    };\n}\n"],"mappings":";;;;;;;;AAMA,IAAY,4DAAL;;;;;AAKH;;;;;AAMA;;;;;AAMA;;;;AAKA;;;;AAKA;;;;AAKA;;;;AAKA;;;;AAKA;;;;AAKA;;;;AAKA;;;;AAKA;;;;AAKA;;;;AAKA;;;;AAKA;;;;AAKA;;;;AAKA;;;;AAKA;;;;;;AAMJ,IAAa,aAAb,MAAa,mBAAmB,MAAM;CAClC,YACI,AAAgBA,MAChB,SACA,AAAgBC,UAClB;AACE,QAAM,QAAQ;EAJE;EAEA;AAGhB,OAAK,OAAO;;;;;CAMhB,mBAAuC;EACnC,MAAMC,WAA+B;GACjC,OAAO,KAAK;GACZ,mBAAmB,KAAK;GAC3B;AAED,MAAI,KAAK,SACL,UAAS,YAAY,KAAK;AAG9B,SAAO;;;;;CAMX,OAAO,aAAa,UAA0C;AAC1D,SAAO,IAAI,WAAW,SAAS,OAAyB,SAAS,qBAAqB,SAAS,OAAO,SAAS,UAAU;;;;;;;;;;;;;;ACzHjI,IAAY,wDAAL;;AAGH;;AAEA;;AAEA;;AAIA;;AAIA;;AAEA;;AAEA;;AAEA;AAGA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;AAqBJ,IAAa,WAAb,cAA8B,MAAM;CAChC,YACI,AAAgBC,MA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