{"version":3,"file":"adk-mcp.cjs","names":["JSONRPCMessageSchema","process","Server","ListToolsRequestSchema","CallToolRequestSchema","normalizeObjectSchema","toJsonSchemaCompat","McpError","ErrorCode","safeParseAsync","getParseErrorMessage","CompleteRequestSchema","getObjectShape","ListResourcesRequestSchema","ListResourceTemplatesRequestSchema","ReadResourceRequestSchema","ListPromptsRequestSchema","GetPromptRequestSchema","objectFromShape","ZodOptional","getSchemaDescription","isSchemaOptional","getLiteralValue"],"sources":["../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js","../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js","../src/mcp/corpus.ts","../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js","../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js","../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js","../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js","../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js","../src/mcp/server.ts"],"sourcesContent":["import { JSONRPCMessageSchema } from '../types.js';\n/**\n * Buffers a continuous stdio stream into discrete JSON-RPC messages.\n */\nexport class ReadBuffer {\n    append(chunk) {\n        this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;\n    }\n    readMessage() {\n        if (!this._buffer) {\n            return null;\n        }\n        const index = this._buffer.indexOf('\\n');\n        if (index === -1) {\n            return null;\n        }\n        const line = this._buffer.toString('utf8', 0, index).replace(/\\r$/, '');\n        this._buffer = this._buffer.subarray(index + 1);\n        return deserializeMessage(line);\n    }\n    clear() {\n        this._buffer = undefined;\n    }\n}\nexport function deserializeMessage(line) {\n    return JSONRPCMessageSchema.parse(JSON.parse(line));\n}\nexport function serializeMessage(message) {\n    return JSON.stringify(message) + '\\n';\n}\n//# sourceMappingURL=stdio.js.map","import process from 'node:process';\nimport { ReadBuffer, serializeMessage } from '../shared/stdio.js';\n/**\n * Server transport for stdio: this communicates with an MCP client by reading from the current process' stdin and writing to stdout.\n *\n * This transport is only available in Node.js environments.\n */\nexport class StdioServerTransport {\n    constructor(_stdin = process.stdin, _stdout = process.stdout) {\n        this._stdin = _stdin;\n        this._stdout = _stdout;\n        this._readBuffer = new ReadBuffer();\n        this._started = false;\n        // Arrow functions to bind `this` properly, while maintaining function identity.\n        this._ondata = (chunk) => {\n            this._readBuffer.append(chunk);\n            this.processReadBuffer();\n        };\n        this._onerror = (error) => {\n            this.onerror?.(error);\n        };\n    }\n    /**\n     * Starts listening for messages on stdin.\n     */\n    async start() {\n        if (this._started) {\n            throw new Error('StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.');\n        }\n        this._started = true;\n        this._stdin.on('data', this._ondata);\n        this._stdin.on('error', this._onerror);\n    }\n    processReadBuffer() {\n        while (true) {\n            try {\n                const message = this._readBuffer.readMessage();\n                if (message === null) {\n                    break;\n                }\n                this.onmessage?.(message);\n            }\n            catch (error) {\n                this.onerror?.(error);\n            }\n        }\n    }\n    async close() {\n        // Remove our event listeners first\n        this._stdin.off('data', this._ondata);\n        this._stdin.off('error', this._onerror);\n        // Check if we were the only data listener\n        const remainingDataListeners = this._stdin.listenerCount('data');\n        if (remainingDataListeners === 0) {\n            // Only pause stdin if we were the only listener\n            // This prevents interfering with other parts of the application that might be using stdin\n            this._stdin.pause();\n        }\n        // Clear the buffer and notify closure\n        this._readBuffer.clear();\n        this.onclose?.();\n    }\n    send(message) {\n        return new Promise(resolve => {\n            const json = serializeMessage(message);\n            if (this._stdout.write(json)) {\n                resolve();\n            }\n            else {\n                this._stdout.once('drain', resolve);\n            }\n        });\n    }\n}\n//# sourceMappingURL=stdio.js.map","import { readFileSync } from 'node:fs'\nimport { fileURLToPath } from 'node:url'\nimport { dirname, join } from 'node:path'\n\nexport interface McpCorpusDocument {\n  id: string\n  title: string\n  kind: 'skill' | 'skill-reference' | 'doc' | 'api' | 'changelog'\n  path: string\n  uri: string\n  content: string\n}\n\nexport interface McpCorpus {\n  packageName: string\n  packageVersion: string\n  docsUrl: string\n  generatedAt: string\n  documents: McpCorpusDocument[]\n}\n\nexport interface SearchResult {\n  document: McpCorpusDocument\n  score: number\n  excerpt: string\n}\n\nconst tokenPattern = /[\\p{L}\\p{N}_.$/-]+/gu\n\nexport const tokenize = (input: string) => input.toLowerCase().match(tokenPattern) ?? []\n\nconst executableDir = () => dirname(fileURLToPath(import.meta.url))\n\nexport const loadCorpus = () => {\n  const path = join(executableDir(), 'mcp', 'adk-docs-corpus.json')\n  return JSON.parse(readFileSync(path, 'utf-8')) as McpCorpus\n}\n\nexport const findDocument = (corpus: McpCorpus, idOrUriOrPath: string) => {\n  const normalized = idOrUriOrPath.replace(/^\\/+|\\/+$/gu, '')\n  return corpus.documents.find(\n    (document) =>\n      document.id === idOrUriOrPath ||\n      document.uri === idOrUriOrPath ||\n      document.path === idOrUriOrPath ||\n      document.path === normalized ||\n      document.path.replace(/\\.md$/u, '') === normalized ||\n      document.uri.replace(/^adk:\\/\\//u, '') === normalized\n  )\n}\n\nconst excerptFor = (content: string, queryTokens: string[], maxLength = 900) => {\n  const lower = content.toLowerCase()\n  const firstHit = queryTokens\n    .map((token) => lower.indexOf(token))\n    .filter((index) => index >= 0)\n    .sort((a, b) => a - b)[0]\n  const start = Math.max(0, (firstHit ?? 0) - 180)\n  const excerpt = content\n    .slice(start, start + maxLength)\n    .replace(/\\s+/gu, ' ')\n    .trim()\n  return `${start > 0 ? '…' : ''}${excerpt}${start + maxLength < content.length ? '…' : ''}`\n}\n\nexport const searchCorpus = (\n  corpus: McpCorpus,\n  query: string,\n  limit = 8,\n  kind?: McpCorpusDocument['kind'] | 'all'\n): SearchResult[] => {\n  const queryTokens = Array.from(new Set(tokenize(query))).filter((token) => token.length > 1)\n  if (!queryTokens.length) return []\n  return corpus.documents\n    .filter((document) => !kind || kind === 'all' || document.kind === kind)\n    .map((document) => {\n      const haystack =\n        `${document.title}\\n${document.kind}\\n${document.path}\\n${document.content}`.toLowerCase()\n      const title = document.title.toLowerCase()\n      const path = document.path.toLowerCase()\n      const score = queryTokens.reduce((sum, token) => {\n        const occurrences = haystack.split(token).length - 1\n        const titleBonus = title.includes(token) ? 8 : 0\n        const pathBonus = path.includes(token) ? 4 : 0\n        return sum + occurrences + titleBonus + pathBonus\n      }, 0)\n      return {\n        document,\n        score,\n        excerpt: excerptFor(document.content, queryTokens),\n      }\n    })\n    .filter((result) => result.score > 0)\n    .sort((a, b) => b.score - a.score || a.document.path.localeCompare(b.document.path))\n    .slice(0, Math.max(1, Math.min(limit, 25)))\n}\n\nexport const assemblyGuidance = (corpus: McpCorpus, topic?: string) => {\n  const skill = corpus.documents.find((document) => document.kind === 'skill')\n  if (!topic) {\n    return [skill, ...corpus.documents.filter((document) => document.kind === 'skill-reference')]\n      .filter((document): document is McpCorpusDocument => Boolean(document))\n      .map((document) => `# ${document.title}\\n\\n${document.content}`)\n      .join('\\n\\n---\\n\\n')\n  }\n  const results = searchCorpus(corpus, topic, 4).filter((result) =>\n    ['skill', 'skill-reference'].includes(result.document.kind)\n  )\n  return results.length\n    ? results\n        .map((result) => `# ${result.document.title}\\n\\n${result.document.content}`)\n        .join('\\n\\n---\\n\\n')\n    : skill?.content || ''\n}\n","export const COMPLETABLE_SYMBOL = Symbol.for('mcp.completable');\n/**\n * Wraps a Zod type to provide autocompletion capabilities. Useful for, e.g., prompt arguments in MCP.\n * Works with both Zod v3 and v4 schemas.\n */\nexport function completable(schema, complete) {\n    Object.defineProperty(schema, COMPLETABLE_SYMBOL, {\n        value: { complete },\n        enumerable: false,\n        writable: false,\n        configurable: false\n    });\n    return schema;\n}\n/**\n * Checks if a schema is completable (has completion metadata).\n */\nexport function isCompletable(schema) {\n    return !!schema && typeof schema === 'object' && COMPLETABLE_SYMBOL in schema;\n}\n/**\n * Gets the completer callback from a completable schema, if it exists.\n */\nexport function getCompleter(schema) {\n    const meta = schema[COMPLETABLE_SYMBOL];\n    return meta?.complete;\n}\n/**\n * Unwraps a completable schema to get the underlying schema.\n * For backward compatibility with code that called `.unwrap()`.\n */\nexport function unwrapCompletable(schema) {\n    return schema;\n}\n// Legacy exports for backward compatibility\n// These types are deprecated but kept for existing code\nexport var McpZodTypeKind;\n(function (McpZodTypeKind) {\n    McpZodTypeKind[\"Completable\"] = \"McpCompletable\";\n})(McpZodTypeKind || (McpZodTypeKind = {}));\n//# sourceMappingURL=completable.js.map","// Claude-authored implementation of RFC 6570 URI Templates\nconst MAX_TEMPLATE_LENGTH = 1000000; // 1MB\nconst MAX_VARIABLE_LENGTH = 1000000; // 1MB\nconst MAX_TEMPLATE_EXPRESSIONS = 10000;\nconst MAX_REGEX_LENGTH = 1000000; // 1MB\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) {\n        // Look for any sequence of characters between curly braces\n        // that isn't just whitespace\n        return /\\{[^}\\s]+\\}/.test(str);\n    }\n    static validateLength(str, max, context) {\n        if (str.length > max) {\n            throw new Error(`${context} exceeds maximum length of ${max} characters (got ${str.length})`);\n        }\n    }\n    get variableNames() {\n        return this.parts.flatMap(part => (typeof part === 'string' ? [] : part.names));\n    }\n    constructor(template) {\n        UriTemplate.validateLength(template, MAX_TEMPLATE_LENGTH, 'Template');\n        this.template = template;\n        this.parts = this.parse(template);\n    }\n    toString() {\n        return this.template;\n    }\n    parse(template) {\n        const parts = [];\n        let currentText = '';\n        let i = 0;\n        let expressionCount = 0;\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)\n                    throw new Error('Unclosed template expression');\n                expressionCount++;\n                if (expressionCount > MAX_TEMPLATE_EXPRESSIONS) {\n                    throw new Error(`Template contains too many expressions (max ${MAX_TEMPLATE_EXPRESSIONS})`);\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                // Validate variable name length\n                for (const name of names) {\n                    UriTemplate.validateLength(name, MAX_VARIABLE_LENGTH, 'Variable name');\n                }\n                parts.push({ name, operator, names, exploded });\n                i = end + 1;\n            }\n            else {\n                currentText += template[i];\n                i++;\n            }\n        }\n        if (currentText) {\n            parts.push(currentText);\n        }\n        return parts;\n    }\n    getOperator(expr) {\n        const operators = ['+', '#', '.', '/', '?', '&'];\n        return operators.find(op => expr.startsWith(op)) || '';\n    }\n    getNames(expr) {\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    encodeValue(value, operator) {\n        UriTemplate.validateLength(value, MAX_VARIABLE_LENGTH, 'Variable value');\n        if (operator === '+' || operator === '#') {\n            return encodeURI(value);\n        }\n        return encodeURIComponent(value);\n    }\n    expandPart(part, variables) {\n        if (part.operator === '?' || part.operator === '&') {\n            const pairs = part.names\n                .map(name => {\n                const value = variables[name];\n                if (value === undefined)\n                    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            if (pairs.length === 0)\n                return '';\n            const separator = part.operator === '?' ? '?' : '&';\n            return separator + pairs.join('&');\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)\n                return '';\n            return values.map(v => (Array.isArray(v) ? v[0] : v)).join(',');\n        }\n        const value = variables[part.name];\n        if (value === undefined)\n            return '';\n        const values = Array.isArray(value) ? value : [value];\n        const encoded = values.map(v => this.encodeValue(v, part.operator));\n        switch (part.operator) {\n            case '':\n                return encoded.join(',');\n            case '+':\n                return encoded.join(',');\n            case '#':\n                return '#' + encoded.join(',');\n            case '.':\n                return '.' + encoded.join('.');\n            case '/':\n                return '/' + encoded.join('/');\n            default:\n                return encoded.join(',');\n        }\n    }\n    expand(variables) {\n        let result = '';\n        let hasQueryParam = false;\n        for (const part of this.parts) {\n            if (typeof part === 'string') {\n                result += part;\n                continue;\n            }\n            const expanded = this.expandPart(part, variables);\n            if (!expanded)\n                continue;\n            // Convert ? to & if we already have a query parameter\n            if ((part.operator === '?' || part.operator === '&') && hasQueryParam) {\n                result += expanded.replace('?', '&');\n            }\n            else {\n                result += expanded;\n            }\n            if (part.operator === '?' || part.operator === '&') {\n                hasQueryParam = true;\n            }\n        }\n        return result;\n    }\n    escapeRegExp(str) {\n        return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n    }\n    partToRegExp(part) {\n        const patterns = [];\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        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        let pattern;\n        const name = part.name;\n        switch (part.operator) {\n            case '':\n                pattern = part.exploded ? '([^/,]+(?:,[^/,]+)*)' : '([^/,]+)';\n                break;\n            case '+':\n            case '#':\n                pattern = '(.+)';\n                break;\n            case '.':\n                pattern = '\\\\.([^/,]+)';\n                break;\n            case '/':\n                pattern = '/' + (part.exploded ? '([^/,]+(?:,[^/,]+)*)' : '([^/,]+)');\n                break;\n            default:\n                pattern = '([^/]+)';\n        }\n        patterns.push({ pattern, name });\n        return patterns;\n    }\n    match(uri) {\n        UriTemplate.validateLength(uri, MAX_TEMPLATE_LENGTH, 'URI');\n        let pattern = '^';\n        const names = [];\n        for (const part of this.parts) {\n            if (typeof part === 'string') {\n                pattern += this.escapeRegExp(part);\n            }\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        pattern += '$';\n        UriTemplate.validateLength(pattern, MAX_REGEX_LENGTH, 'Generated regex pattern');\n        const regex = new RegExp(pattern);\n        const match = uri.match(regex);\n        if (!match)\n            return null;\n        const result = {};\n        for (let i = 0; i < names.length; i++) {\n            const { name, exploded } = names[i];\n            const value = match[i + 1];\n            const cleanName = name.replace('*', '');\n            if (exploded && value.includes(',')) {\n                result[cleanName] = value.split(',');\n            }\n            else {\n                result[cleanName] = value;\n            }\n        }\n        return result;\n    }\n}\n//# sourceMappingURL=uriTemplate.js.map","/**\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/**\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 * 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) {\n    const warnings = [];\n    // Check length\n    if (name.length === 0) {\n        return {\n            isValid: false,\n            warnings: ['Tool name cannot be empty']\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    // 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    if (name.includes(',')) {\n        warnings.push('Tool name contains commas, which may cause parsing issues');\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    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    // Check for invalid characters\n    if (!TOOL_NAME_REGEX.test(name)) {\n        const invalidChars = name\n            .split('')\n            .filter(char => !/[A-Za-z0-9._-]/.test(char))\n            .filter((char, index, arr) => arr.indexOf(char) === index); // Remove duplicates\n        warnings.push(`Tool name contains invalid characters: ${invalidChars.map(c => `\"${c}\"`).join(', ')}`, 'Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)');\n        return {\n            isValid: false,\n            warnings\n        };\n    }\n    return {\n        isValid: true,\n        warnings\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, warnings) {\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('See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.');\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) {\n    const result = validateToolName(name);\n    // Always issue warnings for any validation issues (both invalid names and warnings)\n    issueToolNameWarning(name, result.warnings);\n    return result.isValid;\n}\n//# sourceMappingURL=toolNameValidation.js.map","/**\n * Experimental McpServer task features for MCP SDK.\n * WARNING: These APIs are experimental and may change without notice.\n *\n * @experimental\n */\n/**\n * Experimental task features for McpServer.\n *\n * Access via `server.experimental.tasks`:\n * ```typescript\n * server.experimental.tasks.registerToolTask('long-running', config, handler);\n * ```\n *\n * @experimental\n */\nexport class ExperimentalMcpServerTasks {\n    constructor(_mcpServer) {\n        this._mcpServer = _mcpServer;\n    }\n    registerToolTask(name, config, handler) {\n        // Validate that taskSupport is not 'forbidden' for task-based tools\n        const execution = { taskSupport: 'required', ...config.execution };\n        if (execution.taskSupport === 'forbidden') {\n            throw new Error(`Cannot register task-based tool '${name}' with taskSupport 'forbidden'. Use registerTool() instead.`);\n        }\n        // Access McpServer's internal _createRegisteredTool method\n        const mcpServerInternal = this._mcpServer;\n        return mcpServerInternal._createRegisteredTool(name, config.title, config.description, config.inputSchema, config.outputSchema, config.annotations, execution, config._meta, handler);\n    }\n}\n//# sourceMappingURL=mcp-server.js.map","import { Server } from './index.js';\nimport { normalizeObjectSchema, safeParseAsync, getObjectShape, objectFromShape, getParseErrorMessage, getSchemaDescription, isSchemaOptional, getLiteralValue } from './zod-compat.js';\nimport { toJsonSchemaCompat } from './zod-json-schema-compat.js';\nimport { McpError, ErrorCode, ListResourceTemplatesRequestSchema, ReadResourceRequestSchema, ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, CompleteRequestSchema, assertCompleteRequestPrompt, assertCompleteRequestResourceTemplate } from '../types.js';\nimport { isCompletable, getCompleter } from './completable.js';\nimport { UriTemplate } from '../shared/uriTemplate.js';\nimport { validateAndWarnToolName } from '../shared/toolNameValidation.js';\nimport { ExperimentalMcpServerTasks } from '../experimental/tasks/mcp-server.js';\nimport { ZodOptional } from 'zod';\n/**\n * High-level MCP server that provides a simpler API for working with resources, tools, and prompts.\n * For advanced usage (like sending notifications or setting custom request handlers), use the underlying\n * Server instance available via the `server` property.\n */\nexport class McpServer {\n    constructor(serverInfo, options) {\n        this._registeredResources = {};\n        this._registeredResourceTemplates = {};\n        this._registeredTools = {};\n        this._registeredPrompts = {};\n        this._toolHandlersInitialized = false;\n        this._completionHandlerInitialized = false;\n        this._resourceHandlersInitialized = false;\n        this._promptHandlersInitialized = false;\n        this.server = new Server(serverInfo, options);\n    }\n    /**\n     * Access experimental features.\n     *\n     * WARNING: These APIs are experimental and may change without notice.\n     *\n     * @experimental\n     */\n    get experimental() {\n        if (!this._experimental) {\n            this._experimental = {\n                tasks: new ExperimentalMcpServerTasks(this)\n            };\n        }\n        return this._experimental;\n    }\n    /**\n     * Attaches to the given transport, starts it, and starts listening for messages.\n     *\n     * The `server` object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.\n     */\n    async connect(transport) {\n        return await this.server.connect(transport);\n    }\n    /**\n     * Closes the connection.\n     */\n    async close() {\n        await this.server.close();\n    }\n    setToolRequestHandlers() {\n        if (this._toolHandlersInitialized) {\n            return;\n        }\n        this.server.assertCanSetRequestHandler(getMethodValue(ListToolsRequestSchema));\n        this.server.assertCanSetRequestHandler(getMethodValue(CallToolRequestSchema));\n        this.server.registerCapabilities({\n            tools: {\n                listChanged: true\n            }\n        });\n        this.server.setRequestHandler(ListToolsRequestSchema, () => ({\n            tools: Object.entries(this._registeredTools)\n                .filter(([, tool]) => tool.enabled)\n                .map(([name, tool]) => {\n                const toolDefinition = {\n                    name,\n                    title: tool.title,\n                    description: tool.description,\n                    inputSchema: (() => {\n                        const obj = normalizeObjectSchema(tool.inputSchema);\n                        return obj\n                            ? toJsonSchemaCompat(obj, {\n                                strictUnions: true,\n                                pipeStrategy: 'input'\n                            })\n                            : EMPTY_OBJECT_JSON_SCHEMA;\n                    })(),\n                    annotations: tool.annotations,\n                    execution: tool.execution,\n                    _meta: tool._meta\n                };\n                if (tool.outputSchema) {\n                    const obj = normalizeObjectSchema(tool.outputSchema);\n                    if (obj) {\n                        toolDefinition.outputSchema = toJsonSchemaCompat(obj, {\n                            strictUnions: true,\n                            pipeStrategy: 'output'\n                        });\n                    }\n                }\n                return toolDefinition;\n            })\n        }));\n        this.server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {\n            try {\n                const tool = this._registeredTools[request.params.name];\n                if (!tool) {\n                    throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} not found`);\n                }\n                if (!tool.enabled) {\n                    throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} disabled`);\n                }\n                const isTaskRequest = !!request.params.task;\n                const taskSupport = tool.execution?.taskSupport;\n                const isTaskHandler = 'createTask' in tool.handler;\n                // Validate task hint configuration\n                if ((taskSupport === 'required' || taskSupport === 'optional') && !isTaskHandler) {\n                    throw new McpError(ErrorCode.InternalError, `Tool ${request.params.name} has taskSupport '${taskSupport}' but was not registered with registerToolTask`);\n                }\n                // Handle taskSupport 'required' without task augmentation\n                if (taskSupport === 'required' && !isTaskRequest) {\n                    throw new McpError(ErrorCode.MethodNotFound, `Tool ${request.params.name} requires task augmentation (taskSupport: 'required')`);\n                }\n                // Handle taskSupport 'optional' without task augmentation - automatic polling\n                if (taskSupport === 'optional' && !isTaskRequest && isTaskHandler) {\n                    return await this.handleAutomaticTaskPolling(tool, request, extra);\n                }\n                // Normal execution path\n                const args = await this.validateToolInput(tool, request.params.arguments, request.params.name);\n                const result = await this.executeToolHandler(tool, args, extra);\n                // Return CreateTaskResult immediately for task requests\n                if (isTaskRequest) {\n                    return result;\n                }\n                // Validate output schema for non-task requests\n                await this.validateToolOutput(tool, result, request.params.name);\n                return result;\n            }\n            catch (error) {\n                if (error instanceof McpError) {\n                    if (error.code === ErrorCode.UrlElicitationRequired) {\n                        throw error; // Return the error to the caller without wrapping in CallToolResult\n                    }\n                }\n                return this.createToolError(error instanceof Error ? error.message : String(error));\n            }\n        });\n        this._toolHandlersInitialized = true;\n    }\n    /**\n     * Creates a tool error result.\n     *\n     * @param errorMessage - The error message.\n     * @returns The tool error result.\n     */\n    createToolError(errorMessage) {\n        return {\n            content: [\n                {\n                    type: 'text',\n                    text: errorMessage\n                }\n            ],\n            isError: true\n        };\n    }\n    /**\n     * Validates tool input arguments against the tool's input schema.\n     */\n    async validateToolInput(tool, args, toolName) {\n        if (!tool.inputSchema) {\n            return undefined;\n        }\n        // Try to normalize to object schema first (for raw shapes and object schemas)\n        // If that fails, use the schema directly (for union/intersection/etc)\n        const inputObj = normalizeObjectSchema(tool.inputSchema);\n        const schemaToParse = inputObj ?? tool.inputSchema;\n        const parseResult = await safeParseAsync(schemaToParse, args);\n        if (!parseResult.success) {\n            const error = 'error' in parseResult ? parseResult.error : 'Unknown error';\n            const errorMessage = getParseErrorMessage(error);\n            throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${errorMessage}`);\n        }\n        return parseResult.data;\n    }\n    /**\n     * Validates tool output against the tool's output schema.\n     */\n    async validateToolOutput(tool, result, toolName) {\n        if (!tool.outputSchema) {\n            return;\n        }\n        // Only validate CallToolResult, not CreateTaskResult\n        if (!('content' in result)) {\n            return;\n        }\n        if (result.isError) {\n            return;\n        }\n        if (!result.structuredContent) {\n            throw new McpError(ErrorCode.InvalidParams, `Output validation error: Tool ${toolName} has an output schema but no structured content was provided`);\n        }\n        // if the tool has an output schema, validate structured content\n        const outputObj = normalizeObjectSchema(tool.outputSchema);\n        const parseResult = await safeParseAsync(outputObj, result.structuredContent);\n        if (!parseResult.success) {\n            const error = 'error' in parseResult ? parseResult.error : 'Unknown error';\n            const errorMessage = getParseErrorMessage(error);\n            throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${errorMessage}`);\n        }\n    }\n    /**\n     * Executes a tool handler (either regular or task-based).\n     */\n    async executeToolHandler(tool, args, extra) {\n        const handler = tool.handler;\n        const isTaskHandler = 'createTask' in handler;\n        if (isTaskHandler) {\n            if (!extra.taskStore) {\n                throw new Error('No task store provided.');\n            }\n            const taskExtra = { ...extra, taskStore: extra.taskStore };\n            if (tool.inputSchema) {\n                const typedHandler = handler;\n                // eslint-disable-next-line @typescript-eslint/no-explicit-any\n                return await Promise.resolve(typedHandler.createTask(args, taskExtra));\n            }\n            else {\n                const typedHandler = handler;\n                // eslint-disable-next-line @typescript-eslint/no-explicit-any\n                return await Promise.resolve(typedHandler.createTask(taskExtra));\n            }\n        }\n        if (tool.inputSchema) {\n            const typedHandler = handler;\n            // eslint-disable-next-line @typescript-eslint/no-explicit-any\n            return await Promise.resolve(typedHandler(args, extra));\n        }\n        else {\n            const typedHandler = handler;\n            // eslint-disable-next-line @typescript-eslint/no-explicit-any\n            return await Promise.resolve(typedHandler(extra));\n        }\n    }\n    /**\n     * Handles automatic task polling for tools with taskSupport 'optional'.\n     */\n    async handleAutomaticTaskPolling(tool, request, extra) {\n        if (!extra.taskStore) {\n            throw new Error('No task store provided for task-capable tool.');\n        }\n        // Validate input and create task\n        const args = await this.validateToolInput(tool, request.params.arguments, request.params.name);\n        const handler = tool.handler;\n        const taskExtra = { ...extra, taskStore: extra.taskStore };\n        const createTaskResult = args // undefined only if tool.inputSchema is undefined\n            ? await Promise.resolve(handler.createTask(args, taskExtra))\n            : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n                await Promise.resolve(handler.createTask(taskExtra));\n        // Poll until completion\n        const taskId = createTaskResult.task.taskId;\n        let task = createTaskResult.task;\n        const pollInterval = task.pollInterval ?? 5000;\n        while (task.status !== 'completed' && task.status !== 'failed' && task.status !== 'cancelled') {\n            await new Promise(resolve => setTimeout(resolve, pollInterval));\n            const updatedTask = await extra.taskStore.getTask(taskId);\n            if (!updatedTask) {\n                throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);\n            }\n            task = updatedTask;\n        }\n        // Return the final result\n        return (await extra.taskStore.getTaskResult(taskId));\n    }\n    setCompletionRequestHandler() {\n        if (this._completionHandlerInitialized) {\n            return;\n        }\n        this.server.assertCanSetRequestHandler(getMethodValue(CompleteRequestSchema));\n        this.server.registerCapabilities({\n            completions: {}\n        });\n        this.server.setRequestHandler(CompleteRequestSchema, async (request) => {\n            switch (request.params.ref.type) {\n                case 'ref/prompt':\n                    assertCompleteRequestPrompt(request);\n                    return this.handlePromptCompletion(request, request.params.ref);\n                case 'ref/resource':\n                    assertCompleteRequestResourceTemplate(request);\n                    return this.handleResourceCompletion(request, request.params.ref);\n                default:\n                    throw new McpError(ErrorCode.InvalidParams, `Invalid completion reference: ${request.params.ref}`);\n            }\n        });\n        this._completionHandlerInitialized = true;\n    }\n    async handlePromptCompletion(request, ref) {\n        const prompt = this._registeredPrompts[ref.name];\n        if (!prompt) {\n            throw new McpError(ErrorCode.InvalidParams, `Prompt ${ref.name} not found`);\n        }\n        if (!prompt.enabled) {\n            throw new McpError(ErrorCode.InvalidParams, `Prompt ${ref.name} disabled`);\n        }\n        if (!prompt.argsSchema) {\n            return EMPTY_COMPLETION_RESULT;\n        }\n        const promptShape = getObjectShape(prompt.argsSchema);\n        const field = promptShape?.[request.params.argument.name];\n        if (!isCompletable(field)) {\n            return EMPTY_COMPLETION_RESULT;\n        }\n        const completer = getCompleter(field);\n        if (!completer) {\n            return EMPTY_COMPLETION_RESULT;\n        }\n        const suggestions = await completer(request.params.argument.value, request.params.context);\n        return createCompletionResult(suggestions);\n    }\n    async handleResourceCompletion(request, ref) {\n        const template = Object.values(this._registeredResourceTemplates).find(t => t.resourceTemplate.uriTemplate.toString() === ref.uri);\n        if (!template) {\n            if (this._registeredResources[ref.uri]) {\n                // Attempting to autocomplete a fixed resource URI is not an error in the spec (but probably should be).\n                return EMPTY_COMPLETION_RESULT;\n            }\n            throw new McpError(ErrorCode.InvalidParams, `Resource template ${request.params.ref.uri} not found`);\n        }\n        const completer = template.resourceTemplate.completeCallback(request.params.argument.name);\n        if (!completer) {\n            return EMPTY_COMPLETION_RESULT;\n        }\n        const suggestions = await completer(request.params.argument.value, request.params.context);\n        return createCompletionResult(suggestions);\n    }\n    setResourceRequestHandlers() {\n        if (this._resourceHandlersInitialized) {\n            return;\n        }\n        this.server.assertCanSetRequestHandler(getMethodValue(ListResourcesRequestSchema));\n        this.server.assertCanSetRequestHandler(getMethodValue(ListResourceTemplatesRequestSchema));\n        this.server.assertCanSetRequestHandler(getMethodValue(ReadResourceRequestSchema));\n        this.server.registerCapabilities({\n            resources: {\n                listChanged: true\n            }\n        });\n        this.server.setRequestHandler(ListResourcesRequestSchema, async (request, extra) => {\n            const resources = Object.entries(this._registeredResources)\n                .filter(([_, resource]) => resource.enabled)\n                .map(([uri, resource]) => ({\n                uri,\n                name: resource.name,\n                ...resource.metadata\n            }));\n            const templateResources = [];\n            for (const template of Object.values(this._registeredResourceTemplates)) {\n                if (!template.resourceTemplate.listCallback) {\n                    continue;\n                }\n                const result = await template.resourceTemplate.listCallback(extra);\n                for (const resource of result.resources) {\n                    templateResources.push({\n                        ...template.metadata,\n                        // the defined resource metadata should override the template metadata if present\n                        ...resource\n                    });\n                }\n            }\n            return { resources: [...resources, ...templateResources] };\n        });\n        this.server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => {\n            const resourceTemplates = Object.entries(this._registeredResourceTemplates).map(([name, template]) => ({\n                name,\n                uriTemplate: template.resourceTemplate.uriTemplate.toString(),\n                ...template.metadata\n            }));\n            return { resourceTemplates };\n        });\n        this.server.setRequestHandler(ReadResourceRequestSchema, async (request, extra) => {\n            const uri = new URL(request.params.uri);\n            // First check for exact resource match\n            const resource = this._registeredResources[uri.toString()];\n            if (resource) {\n                if (!resource.enabled) {\n                    throw new McpError(ErrorCode.InvalidParams, `Resource ${uri} disabled`);\n                }\n                return resource.readCallback(uri, extra);\n            }\n            // Then check templates\n            for (const template of Object.values(this._registeredResourceTemplates)) {\n                const variables = template.resourceTemplate.uriTemplate.match(uri.toString());\n                if (variables) {\n                    return template.readCallback(uri, variables, extra);\n                }\n            }\n            throw new McpError(ErrorCode.InvalidParams, `Resource ${uri} not found`);\n        });\n        this._resourceHandlersInitialized = true;\n    }\n    setPromptRequestHandlers() {\n        if (this._promptHandlersInitialized) {\n            return;\n        }\n        this.server.assertCanSetRequestHandler(getMethodValue(ListPromptsRequestSchema));\n        this.server.assertCanSetRequestHandler(getMethodValue(GetPromptRequestSchema));\n        this.server.registerCapabilities({\n            prompts: {\n                listChanged: true\n            }\n        });\n        this.server.setRequestHandler(ListPromptsRequestSchema, () => ({\n            prompts: Object.entries(this._registeredPrompts)\n                .filter(([, prompt]) => prompt.enabled)\n                .map(([name, prompt]) => {\n                return {\n                    name,\n                    title: prompt.title,\n                    description: prompt.description,\n                    arguments: prompt.argsSchema ? promptArgumentsFromSchema(prompt.argsSchema) : undefined\n                };\n            })\n        }));\n        this.server.setRequestHandler(GetPromptRequestSchema, async (request, extra) => {\n            const prompt = this._registeredPrompts[request.params.name];\n            if (!prompt) {\n                throw new McpError(ErrorCode.InvalidParams, `Prompt ${request.params.name} not found`);\n            }\n            if (!prompt.enabled) {\n                throw new McpError(ErrorCode.InvalidParams, `Prompt ${request.params.name} disabled`);\n            }\n            if (prompt.argsSchema) {\n                const argsObj = normalizeObjectSchema(prompt.argsSchema);\n                const parseResult = await safeParseAsync(argsObj, request.params.arguments);\n                if (!parseResult.success) {\n                    const error = 'error' in parseResult ? parseResult.error : 'Unknown error';\n                    const errorMessage = getParseErrorMessage(error);\n                    throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${errorMessage}`);\n                }\n                const args = parseResult.data;\n                const cb = prompt.callback;\n                return await Promise.resolve(cb(args, extra));\n            }\n            else {\n                const cb = prompt.callback;\n                // eslint-disable-next-line @typescript-eslint/no-explicit-any\n                return await Promise.resolve(cb(extra));\n            }\n        });\n        this._promptHandlersInitialized = true;\n    }\n    resource(name, uriOrTemplate, ...rest) {\n        let metadata;\n        if (typeof rest[0] === 'object') {\n            metadata = rest.shift();\n        }\n        const readCallback = rest[0];\n        if (typeof uriOrTemplate === 'string') {\n            if (this._registeredResources[uriOrTemplate]) {\n                throw new Error(`Resource ${uriOrTemplate} is already registered`);\n            }\n            const registeredResource = this._createRegisteredResource(name, undefined, uriOrTemplate, metadata, readCallback);\n            this.setResourceRequestHandlers();\n            this.sendResourceListChanged();\n            return registeredResource;\n        }\n        else {\n            if (this._registeredResourceTemplates[name]) {\n                throw new Error(`Resource template ${name} is already registered`);\n            }\n            const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, undefined, uriOrTemplate, metadata, readCallback);\n            this.setResourceRequestHandlers();\n            this.sendResourceListChanged();\n            return registeredResourceTemplate;\n        }\n    }\n    registerResource(name, uriOrTemplate, config, readCallback) {\n        if (typeof uriOrTemplate === 'string') {\n            if (this._registeredResources[uriOrTemplate]) {\n                throw new Error(`Resource ${uriOrTemplate} is already registered`);\n            }\n            const registeredResource = this._createRegisteredResource(name, config.title, uriOrTemplate, config, readCallback);\n            this.setResourceRequestHandlers();\n            this.sendResourceListChanged();\n            return registeredResource;\n        }\n        else {\n            if (this._registeredResourceTemplates[name]) {\n                throw new Error(`Resource template ${name} is already registered`);\n            }\n            const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, config.title, uriOrTemplate, config, readCallback);\n            this.setResourceRequestHandlers();\n            this.sendResourceListChanged();\n            return registeredResourceTemplate;\n        }\n    }\n    _createRegisteredResource(name, title, uri, metadata, readCallback) {\n        const registeredResource = {\n            name,\n            title,\n            metadata,\n            readCallback,\n            enabled: true,\n            disable: () => registeredResource.update({ enabled: false }),\n            enable: () => registeredResource.update({ enabled: true }),\n            remove: () => registeredResource.update({ uri: null }),\n            update: updates => {\n                if (typeof updates.uri !== 'undefined' && updates.uri !== uri) {\n                    delete this._registeredResources[uri];\n                    if (updates.uri)\n                        this._registeredResources[updates.uri] = registeredResource;\n                }\n                if (typeof updates.name !== 'undefined')\n                    registeredResource.name = updates.name;\n                if (typeof updates.title !== 'undefined')\n                    registeredResource.title = updates.title;\n                if (typeof updates.metadata !== 'undefined')\n                    registeredResource.metadata = updates.metadata;\n                if (typeof updates.callback !== 'undefined')\n                    registeredResource.readCallback = updates.callback;\n                if (typeof updates.enabled !== 'undefined')\n                    registeredResource.enabled = updates.enabled;\n                this.sendResourceListChanged();\n            }\n        };\n        this._registeredResources[uri] = registeredResource;\n        return registeredResource;\n    }\n    _createRegisteredResourceTemplate(name, title, template, metadata, readCallback) {\n        const registeredResourceTemplate = {\n            resourceTemplate: template,\n            title,\n            metadata,\n            readCallback,\n            enabled: true,\n            disable: () => registeredResourceTemplate.update({ enabled: false }),\n            enable: () => registeredResourceTemplate.update({ enabled: true }),\n            remove: () => registeredResourceTemplate.update({ name: null }),\n            update: updates => {\n                if (typeof updates.name !== 'undefined' && updates.name !== name) {\n                    delete this._registeredResourceTemplates[name];\n                    if (updates.name)\n                        this._registeredResourceTemplates[updates.name] = registeredResourceTemplate;\n                }\n                if (typeof updates.title !== 'undefined')\n                    registeredResourceTemplate.title = updates.title;\n                if (typeof updates.template !== 'undefined')\n                    registeredResourceTemplate.resourceTemplate = updates.template;\n                if (typeof updates.metadata !== 'undefined')\n                    registeredResourceTemplate.metadata = updates.metadata;\n                if (typeof updates.callback !== 'undefined')\n                    registeredResourceTemplate.readCallback = updates.callback;\n                if (typeof updates.enabled !== 'undefined')\n                    registeredResourceTemplate.enabled = updates.enabled;\n                this.sendResourceListChanged();\n            }\n        };\n        this._registeredResourceTemplates[name] = registeredResourceTemplate;\n        // If the resource template has any completion callbacks, enable completions capability\n        const variableNames = template.uriTemplate.variableNames;\n        const hasCompleter = Array.isArray(variableNames) && variableNames.some(v => !!template.completeCallback(v));\n        if (hasCompleter) {\n            this.setCompletionRequestHandler();\n        }\n        return registeredResourceTemplate;\n    }\n    _createRegisteredPrompt(name, title, description, argsSchema, callback) {\n        const registeredPrompt = {\n            title,\n            description,\n            argsSchema: argsSchema === undefined ? undefined : objectFromShape(argsSchema),\n            callback,\n            enabled: true,\n            disable: () => registeredPrompt.update({ enabled: false }),\n            enable: () => registeredPrompt.update({ enabled: true }),\n            remove: () => registeredPrompt.update({ name: null }),\n            update: updates => {\n                if (typeof updates.name !== 'undefined' && updates.name !== name) {\n                    delete this._registeredPrompts[name];\n                    if (updates.name)\n                        this._registeredPrompts[updates.name] = registeredPrompt;\n                }\n                if (typeof updates.title !== 'undefined')\n                    registeredPrompt.title = updates.title;\n                if (typeof updates.description !== 'undefined')\n                    registeredPrompt.description = updates.description;\n                if (typeof updates.argsSchema !== 'undefined')\n                    registeredPrompt.argsSchema = objectFromShape(updates.argsSchema);\n                if (typeof updates.callback !== 'undefined')\n                    registeredPrompt.callback = updates.callback;\n                if (typeof updates.enabled !== 'undefined')\n                    registeredPrompt.enabled = updates.enabled;\n                this.sendPromptListChanged();\n            }\n        };\n        this._registeredPrompts[name] = registeredPrompt;\n        // If any argument uses a Completable schema, enable completions capability\n        if (argsSchema) {\n            const hasCompletable = Object.values(argsSchema).some(field => {\n                const inner = field instanceof ZodOptional ? field._def?.innerType : field;\n                return isCompletable(inner);\n            });\n            if (hasCompletable) {\n                this.setCompletionRequestHandler();\n            }\n        }\n        return registeredPrompt;\n    }\n    _createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, execution, _meta, handler) {\n        // Validate tool name according to SEP specification\n        validateAndWarnToolName(name);\n        const registeredTool = {\n            title,\n            description,\n            inputSchema: getZodSchemaObject(inputSchema),\n            outputSchema: getZodSchemaObject(outputSchema),\n            annotations,\n            execution,\n            _meta,\n            handler: handler,\n            enabled: true,\n            disable: () => registeredTool.update({ enabled: false }),\n            enable: () => registeredTool.update({ enabled: true }),\n            remove: () => registeredTool.update({ name: null }),\n            update: updates => {\n                if (typeof updates.name !== 'undefined' && updates.name !== name) {\n                    if (typeof updates.name === 'string') {\n                        validateAndWarnToolName(updates.name);\n                    }\n                    delete this._registeredTools[name];\n                    if (updates.name)\n                        this._registeredTools[updates.name] = registeredTool;\n                }\n                if (typeof updates.title !== 'undefined')\n                    registeredTool.title = updates.title;\n                if (typeof updates.description !== 'undefined')\n                    registeredTool.description = updates.description;\n                if (typeof updates.paramsSchema !== 'undefined')\n                    registeredTool.inputSchema = objectFromShape(updates.paramsSchema);\n                if (typeof updates.outputSchema !== 'undefined')\n                    registeredTool.outputSchema = objectFromShape(updates.outputSchema);\n                if (typeof updates.callback !== 'undefined')\n                    registeredTool.handler = updates.callback;\n                if (typeof updates.annotations !== 'undefined')\n                    registeredTool.annotations = updates.annotations;\n                if (typeof updates._meta !== 'undefined')\n                    registeredTool._meta = updates._meta;\n                if (typeof updates.enabled !== 'undefined')\n                    registeredTool.enabled = updates.enabled;\n                this.sendToolListChanged();\n            }\n        };\n        this._registeredTools[name] = registeredTool;\n        this.setToolRequestHandlers();\n        this.sendToolListChanged();\n        return registeredTool;\n    }\n    /**\n     * tool() implementation. Parses arguments passed to overrides defined above.\n     */\n    tool(name, ...rest) {\n        if (this._registeredTools[name]) {\n            throw new Error(`Tool ${name} is already registered`);\n        }\n        let description;\n        let inputSchema;\n        let outputSchema;\n        let annotations;\n        // Tool properties are passed as separate arguments, with omissions allowed.\n        // Support for this style is frozen as of protocol version 2025-03-26. Future additions\n        // to tool definition should *NOT* be added.\n        if (typeof rest[0] === 'string') {\n            description = rest.shift();\n        }\n        // Handle the different overload combinations\n        if (rest.length > 1) {\n            // We have at least one more arg before the callback\n            const firstArg = rest[0];\n            if (isZodRawShapeCompat(firstArg)) {\n                // We have a params schema as the first arg\n                inputSchema = rest.shift();\n                // Check if the next arg is potentially annotations\n                if (rest.length > 1 && typeof rest[0] === 'object' && rest[0] !== null && !isZodRawShapeCompat(rest[0])) {\n                    // Case: tool(name, paramsSchema, annotations, cb)\n                    // Or: tool(name, description, paramsSchema, annotations, cb)\n                    annotations = rest.shift();\n                }\n            }\n            else if (typeof firstArg === 'object' && firstArg !== null) {\n                // ToolAnnotations values are primitives. Nested objects indicate a misplaced schema\n                if (Object.values(firstArg).some(v => typeof v === 'object' && v !== null)) {\n                    throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);\n                }\n                annotations = rest.shift();\n            }\n        }\n        const callback = rest[0];\n        return this._createRegisteredTool(name, undefined, description, inputSchema, outputSchema, annotations, { taskSupport: 'forbidden' }, undefined, callback);\n    }\n    /**\n     * Registers a tool with a config object and callback.\n     */\n    registerTool(name, config, cb) {\n        if (this._registeredTools[name]) {\n            throw new Error(`Tool ${name} is already registered`);\n        }\n        const { title, description, inputSchema, outputSchema, annotations, _meta } = config;\n        return this._createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, { taskSupport: 'forbidden' }, _meta, cb);\n    }\n    prompt(name, ...rest) {\n        if (this._registeredPrompts[name]) {\n            throw new Error(`Prompt ${name} is already registered`);\n        }\n        let description;\n        if (typeof rest[0] === 'string') {\n            description = rest.shift();\n        }\n        let argsSchema;\n        if (rest.length > 1) {\n            argsSchema = rest.shift();\n        }\n        const cb = rest[0];\n        const registeredPrompt = this._createRegisteredPrompt(name, undefined, description, argsSchema, cb);\n        this.setPromptRequestHandlers();\n        this.sendPromptListChanged();\n        return registeredPrompt;\n    }\n    /**\n     * Registers a prompt with a config object and callback.\n     */\n    registerPrompt(name, config, cb) {\n        if (this._registeredPrompts[name]) {\n            throw new Error(`Prompt ${name} is already registered`);\n        }\n        const { title, description, argsSchema } = config;\n        const registeredPrompt = this._createRegisteredPrompt(name, title, description, argsSchema, cb);\n        this.setPromptRequestHandlers();\n        this.sendPromptListChanged();\n        return registeredPrompt;\n    }\n    /**\n     * Checks if the server is connected to a transport.\n     * @returns True if the server is connected\n     */\n    isConnected() {\n        return this.server.transport !== undefined;\n    }\n    /**\n     * Sends a logging message to the client, if connected.\n     * Note: You only need to send the parameters object, not the entire JSON RPC message\n     * @see LoggingMessageNotification\n     * @param params\n     * @param sessionId optional for stateless and backward compatibility\n     */\n    async sendLoggingMessage(params, sessionId) {\n        return this.server.sendLoggingMessage(params, sessionId);\n    }\n    /**\n     * Sends a resource list changed event to the client, if connected.\n     */\n    sendResourceListChanged() {\n        if (this.isConnected()) {\n            this.server.sendResourceListChanged();\n        }\n    }\n    /**\n     * Sends a tool list changed event to the client, if connected.\n     */\n    sendToolListChanged() {\n        if (this.isConnected()) {\n            this.server.sendToolListChanged();\n        }\n    }\n    /**\n     * Sends a prompt list changed event to the client, if connected.\n     */\n    sendPromptListChanged() {\n        if (this.isConnected()) {\n            this.server.sendPromptListChanged();\n        }\n    }\n}\n/**\n * A resource template combines a URI pattern with optional functionality to enumerate\n * all resources matching that pattern.\n */\nexport class ResourceTemplate {\n    constructor(uriTemplate, _callbacks) {\n        this._callbacks = _callbacks;\n        this._uriTemplate = typeof uriTemplate === 'string' ? new UriTemplate(uriTemplate) : uriTemplate;\n    }\n    /**\n     * Gets the URI template pattern.\n     */\n    get uriTemplate() {\n        return this._uriTemplate;\n    }\n    /**\n     * Gets the list callback, if one was provided.\n     */\n    get listCallback() {\n        return this._callbacks.list;\n    }\n    /**\n     * Gets the callback for completing a specific URI template variable, if one was provided.\n     */\n    completeCallback(variable) {\n        return this._callbacks.complete?.[variable];\n    }\n}\nconst EMPTY_OBJECT_JSON_SCHEMA = {\n    type: 'object',\n    properties: {}\n};\n/**\n * Checks if a value looks like a Zod schema by checking for parse/safeParse methods.\n */\nfunction isZodTypeLike(value) {\n    return (value !== null &&\n        typeof value === 'object' &&\n        'parse' in value &&\n        typeof value.parse === 'function' &&\n        'safeParse' in value &&\n        typeof value.safeParse === 'function');\n}\n/**\n * Checks if an object is a Zod schema instance (v3 or v4).\n *\n * Zod schemas have internal markers:\n * - v3: `_def` property\n * - v4: `_zod` property\n *\n * This includes transformed schemas like z.preprocess(), z.transform(), z.pipe().\n */\nfunction isZodSchemaInstance(obj) {\n    return '_def' in obj || '_zod' in obj || isZodTypeLike(obj);\n}\n/**\n * Checks if an object is a \"raw shape\" - a plain object where values are Zod schemas.\n *\n * Raw shapes are used as shorthand: `{ name: z.string() }` instead of `z.object({ name: z.string() })`.\n *\n * IMPORTANT: This must NOT match actual Zod schema instances (like z.preprocess, z.pipe),\n * which have internal properties that could be mistaken for schema values.\n */\nfunction isZodRawShapeCompat(obj) {\n    if (typeof obj !== 'object' || obj === null) {\n        return false;\n    }\n    // If it's already a Zod schema instance, it's NOT a raw shape\n    if (isZodSchemaInstance(obj)) {\n        return false;\n    }\n    // Empty objects are valid raw shapes (tools with no parameters)\n    if (Object.keys(obj).length === 0) {\n        return true;\n    }\n    // A raw shape has at least one property that is a Zod schema\n    return Object.values(obj).some(isZodTypeLike);\n}\n/**\n * Converts a provided Zod schema to a Zod object if it is a ZodRawShapeCompat,\n * otherwise returns the schema as is. Throws if the value is not a valid Zod schema.\n */\nfunction getZodSchemaObject(schema) {\n    if (!schema) {\n        return undefined;\n    }\n    if (isZodRawShapeCompat(schema)) {\n        return objectFromShape(schema);\n    }\n    if (!isZodSchemaInstance(schema)) {\n        throw new Error('inputSchema must be a Zod schema or raw shape, received an unrecognized object');\n    }\n    return schema;\n}\nfunction promptArgumentsFromSchema(schema) {\n    const shape = getObjectShape(schema);\n    if (!shape)\n        return [];\n    return Object.entries(shape).map(([name, field]) => {\n        // Get description - works for both v3 and v4\n        const description = getSchemaDescription(field);\n        // Check if optional - works for both v3 and v4\n        const isOptional = isSchemaOptional(field);\n        return {\n            name,\n            description,\n            required: !isOptional\n        };\n    });\n}\nfunction getMethodValue(schema) {\n    const shape = getObjectShape(schema);\n    const methodSchema = shape?.method;\n    if (!methodSchema) {\n        throw new Error('Schema is missing a method literal');\n    }\n    // Extract literal value - works for both v3 and v4\n    const value = getLiteralValue(methodSchema);\n    if (typeof value === 'string') {\n        return value;\n    }\n    throw new Error('Schema method literal must be a string');\n}\nfunction createCompletionResult(suggestions) {\n    return {\n        completion: {\n            values: suggestions.slice(0, 100),\n            total: suggestions.length,\n            hasMore: suggestions.length > 100\n        }\n    };\n}\nconst EMPTY_COMPLETION_RESULT = {\n    completion: {\n        values: [],\n        hasMore: false\n    }\n};\n//# sourceMappingURL=mcp.js.map","#!/usr/bin/env node\nimport { z } from 'zod/v4'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { assemblyGuidance, findDocument, loadCorpus, searchCorpus } from './corpus'\nimport { McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport type { McpCorpusDocument } from './corpus'\n\nconst corpus = loadCorpus()\n\nconst text = (value: string) => ({\n  content: [\n    {\n      type: 'text' as const,\n      text: value,\n    },\n  ],\n})\n\nconst resourceContents = (document: McpCorpusDocument) => ({\n  contents: [\n    {\n      uri: document.uri,\n      name: document.title,\n      title: document.title,\n      mimeType: 'text/markdown',\n      text: document.content,\n    },\n  ],\n})\n\nconst renderSearchResults = (query: string, results: ReturnType<typeof searchCorpus>) => {\n  if (!results.length) return `No ADK documentation matches found for: ${query}`\n  return results\n    .map(({ document, score, excerpt }, index) =>\n      [\n        `## ${index + 1}. ${document.title}`,\n        `- id: ${document.id}`,\n        `- uri: ${document.uri}`,\n        `- kind: ${document.kind}`,\n        `- path: ${document.path}`,\n        `- score: ${score}`,\n        '',\n        excerpt,\n      ].join('\\n')\n    )\n    .join('\\n\\n')\n}\n\nconst reviewAssembly = (input: string) => {\n  const checks = [\n    {\n      label: 'TurnRunner configured',\n      pass: /TurnRunner|createTurnRunner|runner\\.run/u.test(input),\n      advice:\n        'Create a TurnRunner with explicit storage callbacks, executor, pipelines, and listeners.',\n    },\n    {\n      label: 'Executor terminal signal',\n      pass: /\\.ack\\(|\\.nack\\(/u.test(input),\n      advice: 'Every custom executor must call exactly one of ctx.ack() or ctx.nack(error).',\n    },\n    {\n      label: 'Storage callback surface',\n      pass: /fetchMessagesCallback/u.test(input) && /writeMessageCallback/u.test(input),\n      advice:\n        'Provide the complete storage callback surface, even when callbacks are no-ops for a prototype.',\n    },\n    {\n      label: 'Message hydration',\n      pass: /turnInputPipeline|hydrate/i.test(input),\n      advice:\n        'Hydrate prior messages in turnInputPipeline; RawTurnContext should not carry history directly.',\n    },\n    {\n      label: 'Tool registry wiring',\n      pass: /ToolRegistry|tools\\s*:/u.test(input),\n      advice:\n        'Register tools through ToolRegistry or the runner config; do not invent ToolRegistry.fromTools.',\n    },\n    {\n      label: 'Iteration guard',\n      pass: /iteration/u.test(input),\n      advice: 'Add a dispatch/turn pipeline guard when tool calls or recursive dispatch can loop.',\n    },\n  ]\n  const lines = ['# ADK Assembly Review', '']\n  for (const check of checks) {\n    lines.push(\n      `- ${check.pass ? '✅' : '⚠️'} ${check.label}: ${check.pass ? 'found' : check.advice}`\n    )\n  }\n  lines.push(\n    '',\n    '## Relevant Guidance',\n    '',\n    assemblyGuidance(corpus, 'assembly storage executor pipelines')\n  )\n  return lines.join('\\n')\n}\n\nconst server = new McpServer(\n  {\n    name: '@nhtio/adk',\n    version: corpus.packageVersion,\n  },\n  {\n    instructions:\n      'Portable ADK assembly guidance and offline documentation search for @nhtio/adk. Use the tools to search docs, read resources, inspect API markdown, and review pasted ADK assembly code.',\n  }\n)\n\nserver.registerResource(\n  'adk-documents',\n  new ResourceTemplate('adk://{section}/{path*}', {\n    list: () => ({\n      resources: corpus.documents.map((document) => ({\n        uri: document.uri,\n        name: document.id,\n        title: document.title,\n        description: `${document.kind}: ${document.path}`,\n        mimeType: 'text/markdown',\n      })),\n    }),\n  }),\n  {\n    title: 'ADK Packaged Documentation',\n    description:\n      'Version-aligned @nhtio/adk skill, docs, API, and changelog markdown packaged with npm.',\n    mimeType: 'text/markdown',\n  },\n  (uri) => {\n    const document = findDocument(corpus, uri.toString())\n    if (!document) throw new Error(`Unknown ADK resource: ${uri.toString()}`)\n    return resourceContents(document)\n  }\n)\n\nserver.registerTool(\n  'get_adk_assembly_guidance',\n  {\n    title: 'Get ADK Assembly Guidance',\n    description: 'Return curated ADK assembly Skill guidance, optionally focused by topic.',\n    inputSchema: {\n      topic: z\n        .string()\n        .optional()\n        .describe(\n          'Optional topic such as storage, executor, pipelines, tools, memory, or first integration.'\n        ),\n    },\n  },\n  ({ topic }) => text(assemblyGuidance(corpus, topic))\n)\n\nserver.registerTool(\n  'search_adk_docs',\n  {\n    title: 'Search ADK Docs',\n    description:\n      'Lexically search packaged @nhtio/adk skill, documentation, API markdown, and changelog.',\n    inputSchema: {\n      query: z.string().min(2),\n      limit: z.number().int().min(1).max(25).optional(),\n      kind: z.enum(['all', 'skill', 'skill-reference', 'doc', 'api', 'changelog']).optional(),\n    },\n  },\n  ({ query, limit, kind }) =>\n    text(renderSearchResults(query, searchCorpus(corpus, query, limit ?? 8, kind)))\n)\n\nserver.registerTool(\n  'read_adk_doc',\n  {\n    title: 'Read ADK Doc',\n    description: 'Read a packaged ADK document by id, URI, or repository-relative path.',\n    inputSchema: {\n      id: z.string().describe('Document id, adk:// URI, or path such as docs/quickstart.md.'),\n    },\n  },\n  ({ id }) => {\n    const document = findDocument(corpus, id)\n    if (!document) return text(`Unknown ADK document: ${id}`)\n    return text(`# ${document.title}\\n\\n${document.content}`)\n  }\n)\n\nserver.registerTool(\n  'lookup_adk_api',\n  {\n    title: 'Lookup ADK API',\n    description: 'Search generated TypeDoc API markdown packaged with @nhtio/adk.',\n    inputSchema: {\n      symbol: z.string().min(1).describe('API symbol or concept to find.'),\n      limit: z.number().int().min(1).max(15).optional(),\n    },\n  },\n  ({ symbol, limit }) =>\n    text(renderSearchResults(symbol, searchCorpus(corpus, symbol, limit ?? 6, 'api')))\n)\n\nserver.registerTool(\n  'review_adk_assembly',\n  {\n    title: 'Review ADK Assembly',\n    description:\n      'Review pasted ADK assembly/configuration code against the ADK assembly checklist.',\n    inputSchema: {\n      code: z\n        .string()\n        .min(1)\n        .describe('Pasted ADK setup, TurnRunner config, executor, or related code.'),\n    },\n  },\n  ({ code }) => text(reviewAssembly(code))\n)\n\nserver.registerPrompt(\n  'assemble-adk-agent',\n  {\n    title: 'Assemble an ADK Agent',\n    description: 'Guide an LLM through creating a minimal, correct @nhtio/adk integration.',\n  },\n  () => ({\n    messages: [\n      {\n        role: 'user',\n        content: {\n          type: 'text',\n          text: 'Use get_adk_assembly_guidance first, then help assemble a minimal @nhtio/adk TurnRunner integration with storage callbacks, hydration, executor, and a smoke test.',\n        },\n      },\n    ],\n  })\n)\n\nserver.registerPrompt(\n  'review-adk-agent',\n  {\n    title: 'Review an ADK Agent',\n    description: 'Review pasted ADK integration code for assembly mistakes.',\n  },\n  () => ({\n    messages: [\n      {\n        role: 'user',\n        content: {\n          type: 'text',\n          text: 'Ask for the ADK assembly code, then call review_adk_assembly and explain the highest-risk issues first.',\n        },\n      },\n    ],\n  })\n)\n\nserver.registerPrompt(\n  'debug-adk-assembly',\n  {\n    title: 'Debug ADK Assembly',\n    description: 'Debug common @nhtio/adk wiring failures.',\n  },\n  () => ({\n    messages: [\n      {\n        role: 'user',\n        content: {\n          type: 'text',\n          text: 'Use search_adk_docs for the observed error, then check storage callback arity, ack/nack behavior, hydration, pipeline placement, and tool registry wiring.',\n        },\n      },\n    ],\n  })\n)\n\nconst main = async () => {\n  await server.connect(new StdioServerTransport())\n}\n\nmain().catch((error: unknown) => {\n  console.error(error)\n  process.exitCode = 1\n})\n"],"x_google_ignoreList":[0,1,3,4,5,6,7],"mappings":";;;;;;;;;;;;;AAIA,IAAa,aAAb,MAAwB;CACpB,OAAO,OAAO;EACV,KAAK,UAAU,KAAK,UAAU,OAAO,OAAO,CAAC,KAAK,SAAS,KAAK,CAAC,IAAI;CACzE;CACA,cAAc;EACV,IAAI,CAAC,KAAK,SACN,OAAO;EAEX,MAAM,QAAQ,KAAK,QAAQ,QAAQ,IAAI;EACvC,IAAI,UAAU,IACV,OAAO;EAEX,MAAM,OAAO,KAAK,QAAQ,SAAS,QAAQ,GAAG,KAAK,EAAE,QAAQ,OAAO,EAAE;EACtE,KAAK,UAAU,KAAK,QAAQ,SAAS,QAAQ,CAAC;EAC9C,OAAO,mBAAmB,IAAI;CAClC;CACA,QAAQ;EACJ,KAAK,UAAU,KAAA;CACnB;AACJ;AACA,SAAgB,mBAAmB,MAAM;CACrC,OAAOA,eAAAA,qBAAqB,MAAM,KAAK,MAAM,IAAI,CAAC;AACtD;AACA,SAAgB,iBAAiB,SAAS;CACtC,OAAO,KA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