/** * MCP Elicitation 接线 —— server 注入 + createElicitFn。 * * ⚠️ 与 logger/progress 的关键区别(实现者注意,勿照搬两件套): * - **不带 clientReady gate**:elicitInput 是 request/response(client 必已 initialize * 才到达 middleware),非 fire-and-forget notification(logger/progress 的 clientReady * 是防 notification 握手前崩,elicit 无此问题)。 * - **不需四层参数链**:requestedSchema/message 是 per-call 参数(middleware 局部构造), * _elicitServer 只读共享,elicitInput 按 request id 路由 → 天然并发安全。 * "与 logger/progress 同构"仅指 server 注入模式(模块级 set + null 清理)。 * * 失败安全:client 不支持 / decline / cancel / throw → 返回 null(middleware fallback MISSING_PARAM)。 */ import type { Server } from "@modelcontextprotocol/server"; export interface RequestedSchema { type: 'object'; properties: Record; required: string[]; } export type ElicitFn = (requestedSchema: RequestedSchema, message: string) => Promise | null>; /** 注入 MCP Server 实例(GodotServer 构造时调);null 清除(close/测试隔离) */ export declare function setElicitServer(server: Server | null): void; /** * 创建 elicitFn 实现。闭包捕获模块级 _elicitServer(只读共享)。 * 返回 Record(非 string)——SDK 按 requestedSchema.type 返回对应类型, * number/boolean param 不窄化。 */ export declare function createElicitFn(): ElicitFn; /** 测试隔离 / 干净关闭:重置模块状态 */ export declare function resetElicitServer(): void;