[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ABHBH3H0QRWR9G3RTG1J58":3,"skill-same:01M7ABHBH3H0QRWR9G3RTG1J58":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":14,"repositoryHtmlUrl":29,"repositoryHomepageUrl":30,"ownerHtmlUrl":31,"ownerBlogUrl":32,"ownerDescription":6,"updatedAt":33,"install":34,"resources":47},"01M7ABHBH3H0QRWR9G3RTG1J58","mcp-elicitation",null,"Elicitation: MCP SDK v2 user-input rounds, prompt completion, progress, or cancellation.","j0hanz\u002Fj0hanz-marketplace","j0hanz","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F159924955?v=4","01M7ABFK415CKHXYV9GZRJ16T7","Linus Johansson","01M7ABFK52FCPP2PNBH1YR7ZPA",0,"MIT","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fmcp-hub\u002Fskills\u002Fmcp-elicitation\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: mcp-elicitation\ndescription: 'Elicitation: MCP SDK v2 user-input rounds, prompt completion, progress, or cancellation.'\nuser-invocable: false\nmetadata:\n  category: technique\n---\n\n# MCP Elicitation\n\nImplement mid-call interaction with `@modelcontextprotocol\u002Fserver` v2. Reference: https:\u002F\u002Fts.sdk.modelcontextprotocol.io\u002Fv2\u002F\n\n**Era gotcha.** Modern (2026) handlers return stateless, multi-round `inputRequired(...)` descriptors; 2025 handlers await blocking `elicitInput()`. `elicitInput()` throws on modern connections. With its default `legacyShim: true`, SDK deliver modern `inputRequired(...)` returns to 2025 clients by issuing `elicitation\u002Fcreate`, `sampling\u002FcreateMessage`, and `roots\u002Flist`; not enable `elicitInput()` for modern clients. Progress (`notify`) and cancellation (`signal`) work both eras.\n\n## Steps\n\n1. **Register owned clients before calls**: Advertise elicitation capabilities, bound auto-fulfillment with `inputRequired.maxRounds`, handle `elicitation\u002Fcreate` at construction. Client default 10 rounds; past it client rejects with `SdkError` (`INPUT_REQUIRED_ROUNDS_EXCEEDED`).\n\n   ```ts\n   const client = new Client(\n     { name: 'client', version: '1.0' },\n     {\n       capabilities: { elicitation: { form: {} } },\n       inputRequired: { maxRounds: 10 },\n     },\n   );\n   client.setRequestHandler('elicitation\u002Fcreate', async (req) => {\n     if (req.params.mode === 'url') return { action: 'decline' }; \u002F\u002F mode is omitted on older form requests\n     const content = await renderAndValidateJsonSchemaForm(\n       req.params.message,\n       req.params.requestedSchema,\n     );\n     return content === undefined ? { action: 'decline' } : { action: 'accept', content };\n   });\n   ```\n\n   Host-implemented `renderAndValidateJsonSchemaForm()` (not SDK export) renders requested schema, resolves only validated content; `undefined` means user declined. Add URL capability + owned URL handler only when client can complete that flow.\n\n   **Done:** Every owned client serving interaction advertises only supported modes, has bounded handler, returns content validated against requested schema.\n\n2. **Make modern tool calls replay-safe**: Each answer restarts tool from beginning. Read `ctx.mcpReq.inputResponses` before returning `inputRequired`; use `acceptedContent(..., key, schema)` for accepted content, `inputResponse(...)` to exit clean on `decline` or `cancel`.\n\n   ```ts\n   server.registerTool(\n     'deploy',\n     { inputSchema: z.object({ env: z.string() }) },\n     async ({ env }, ctx) => {\n       const state = inputResponse(ctx.mcpReq.inputResponses, 'confirm');\n       if (state?.kind === 'elicit' && state.action !== 'accept') {\n         return { content: [{ type: 'text', text: 'Deploy cancelled' }] };\n       }\n       const confirmed = acceptedContent(\n         ctx.mcpReq.inputResponses,\n         'confirm',\n         z.object({ confirm: z.boolean() }),\n       )?.confirm;\n       if (confirmed) return { content: [{ type: 'text', text: 'Deployed' }] };\n       return inputRequired({\n         inputRequests: {\n           confirm: inputRequired.elicit({\n             message: 'Deploy?',\n             requestedSchema: { type: 'object', properties: { confirm: { type: 'boolean' } } },\n           }),\n         },\n       });\n     },\n   );\n   ```\n\n   Use `inputRequired.elicit()` for form fields, `inputRequired.elicitUrl()` for redirects like OAuth. Migrate embedded sampling and roots flows off deprecated `inputRequired.createMessage()` and `inputRequired.listRoots()`.\n\n   **Done:** Every modern interaction reads prior responses, returns each accepted path once, terminates every decline\u002Fcancel path.\n\n3. **Carry sequential state in signed `requestState`**: Return opaque, HMAC-signed state value, read via `ctx.mcpReq.requestState\u003CState>()`. Client round-trips value byte-for-byte — keep secrets out, reject tampered\u002Fexpired values with `-32602 Invalid or expired requestState`.\n\n   ```ts\n   const codec = createRequestStateCodec\u003C{ step: string }>({\n     key: crypto.getRandomValues(new Uint8Array(32)),\n     ttlSeconds: 600,\n   });\n   const app = new McpServer(\n     { name: 'app', version: '1.0' },\n     { requestState: { verify: codec.verify } },\n   );\n   \u002F\u002F Inside a tool handler registered on `app`:\n   return inputRequired({\n     inputRequests: { scope: inputRequired.elicit({\u002F* … *\u002F}) },\n     requestState: await codec.mint({ step: 'confirmed' }),\n   });\n   ```\n\n   **Done:** Every multi-round flow stores state in verified codec, rejects invalid state before business logic, exposes no secret in payload.\n\n4. **Report long work, honor cancellation**: Emit strictly increasing `notifications\u002Fprogress` values for one `progressToken`. Pass `ctx.mcpReq.signal` to DB\u002FHTTP work; check `signal.aborted` inside recursive work and loop conditions.\n\n   ```ts\n   async ({ files }, ctx) => {\n     const tok = ctx.mcpReq._meta?.progressToken;\n     for (let i = 0; i \u003C files.length; i++) {\n       if (tok)\n         await ctx.mcpReq.notify({\n           method: 'notifications\u002Fprogress',\n           params: { progressToken: tok, progress: i + 1, total: files.length },\n         });\n     }\n     return { content: [{ type: 'text', text: 'Done' }] };\n   };\n   ```\n\n   **Done:** Each long-running path propagates abort signal, checks it during repeated work, emits monotonic progress when caller supplied token.\n\n5. **Complete prompt arguments at schema**: Wrap prompt `argsSchema` fields with `completable(...)`. Define resource-template completion in template's `complete` map instead.\n\n   ```ts\n   import { completable } from '@modelcontextprotocol\u002Fserver';\n   server.registerPrompt(\n     'review',\n     {\n       argsSchema: z.object({\n         lang: completable(z.string(), (val) =>\n           ['ts', 'js', 'py'].filter((lang) => lang.startsWith(val)),\n         ),\n       }),\n     },\n     ({ lang }) => ({\n       messages: [{ role: 'user', content: { type: 'text', text: `Review ${lang}` } }],\n     }),\n   );\n   ```\n\n   **Done:** Every prompt argument needing completion uses `completable(...)`, every resource-template variable uses its template completion map.\n\n6. **Serve confirmed 2025 connections through legacy branch**: Require client's `elicitation` capability, use form mode for standard data, URL mode for external redirects, return from handler on `decline`\u002F`cancel`. Keep credentials, API keys out of forms. `requestedSchema` defaults JSON Schema 2020-12; declare `$schema` when porting draft-07. `ElicitResult.content` in form mode is submitted form fields as object (e.g. `{ rating: 5, comment: '…' }`) validated against `requestedSchema` — return schema-shaped object.\n\n   ```ts\n   const result = await ctx.mcpReq.elicitInput({\n     mode: 'form',\n     message: 'Rate topic',\n     requestedSchema: {\n       type: 'object',\n       properties: { rating: { type: 'number' } },\n       required: ['rating'],\n     },\n   });\n   if (result.action === 'accept') {\n     return { content: [{ type: 'text', text: `Recorded: ${JSON.stringify(result.content)}` }] };\n   }\n   ```\n\n   **Done:** Each legacy-only flow has confirmed 2025 connection, supported client capability, declared schema dialect when needed, valid result content, terminating non-accept path.\n\n7. **Retire 2025-only facilities**: Replace `ctx.mcpReq.requestSampling` with server direct-LLM-provider call only after recording provider, data-handling\u002Fretention policy, consent path, cost owner; stays functional for 2025 connections but throws for modern ones. Replace deprecated `ctx.mcpReq.log(level, data)` with stderr or OpenTelemetry.\n\n   **Done:** Each direct LLM replacement has recorded provider, privacy\u002Fconsent, cost decision; new interaction paths use neither sampling nor MCP logging; every retained legacy call isolated to confirmed 2025 branch.\n","# MCP Elicitation\n\nImplement mid-call interaction with `@modelcontextprotocol\u002Fserver` v2. Reference: https:\u002F\u002Fts.sdk.modelcontextprotocol.io\u002Fv2\u002F\n\n**Era gotcha.** Modern (2026) handlers return stateless, multi-round `inputRequired(...)` descriptors; 2025 handlers await blocking `elicitInput()`. `elicitInput()` throws on modern connections. With its default `legacyShim: true`, SDK deliver modern `inputRequired(...)` returns to 2025 clients by issuing `elicitation\u002Fcreate`, `sampling\u002FcreateMessage`, and `roots\u002Flist`; not enable `elicitInput()` for modern clients. Progress (`notify`) and cancellation (`signal`) work both eras.\n\n## Steps\n\n1. **Register owned clients before calls**: Advertise elicitation capabilities, bound auto-fulfillment with `inputRequired.maxRounds`, handle `elicitation\u002Fcreate` at construction. Client default 10 rounds; past it client rejects with `SdkError` (`INPUT_REQUIRED_ROUNDS_EXCEEDED`).\n\n   ```ts\n   const client = new Client(\n     { name: 'client', version: '1.0' },\n     {\n       capabilities: { elicitation: { form: {} } },\n       inputRequired: { maxRounds: 10 },\n     },\n   );\n   client.setRequestHandler('elicitation\u002Fcreate', async (req) => {\n     if (req.params.mode === 'url') return { action: 'decline' }; \u002F\u002F mode is omitted on older form requests\n     const content = await renderAndValidateJsonSchemaForm(\n       req.params.message,\n       req.params.requestedSchema,\n     );\n     return content === undefined ? { action: 'decline' } : { action: 'accept', content };\n   });\n   ```\n\n   Host-implemented `renderAndValidateJsonSchemaForm()` (not SDK export) renders requested schema, resolves only validated content; `undefined` means user declined. Add URL capability + owned URL handler only when client can complete that flow.\n\n   **Done:** Every owned client serving interaction advertises only supported modes, has bounded handler, returns content validated against requested schema.\n\n2. **Make modern tool calls replay-safe**: Each answer restarts tool from beginning. Read `ctx.mcpReq.inputResponses` before returning `inputRequired`; use `acceptedContent(..., key, schema)` for accepted content, `inputResponse(...)` to exit clean on `decline` or `cancel`.\n\n   ```ts\n   server.registerTool(\n     'deploy',\n     { inputSchema: z.object({ env: z.string() }) },\n     async ({ env }, ctx) => {\n       const state = inputResponse(ctx.mcpReq.inputResponses, 'confirm');\n       if (state?.kind === 'elicit' && state.action !== 'accept') {\n         return { content: [{ type: 'text', text: 'Deploy cancelled' }] };\n       }\n       const confirmed = acceptedContent(\n         ctx.mcpReq.inputResponses,\n         'confirm',\n         z.object({ confirm: z.boolean() }),\n       )?.confirm;\n       if (confirmed) return { content: [{ type: 'text', text: 'Deployed' }] };\n       return inputRequired({\n         inputRequests: {\n           confirm: inputRequired.elicit({\n             message: 'Deploy?',\n             requestedSchema: { type: 'object', properties: { confirm: { type: 'boolean' } } },\n           }),\n         },\n       });\n     },\n   );\n   ```\n\n   Use `inputRequired.elicit()` for form fields, `inputRequired.elicitUrl()` for redirects like OAuth. Migrate embedded sampling and roots flows off deprecated `inputRequired.createMessage()` and `inputRequired.listRoots()`.\n\n   **Done:** Every modern interaction reads prior responses, returns each accepted path once, terminates every decline\u002Fcancel path.\n\n3. **Carry sequential state in signed `requestState`**: Return opaque, HMAC-signed state value, read via `ctx.mcpReq.requestState\u003CState>()`. Client round-trips value byte-for-byte — keep secrets out, reject tampered\u002Fexpired values with `-32602 Invalid or expired requestState`.\n\n   ```ts\n   const codec = createRequestStateCodec\u003C{ step: string }>({\n     key: crypto.getRandomValues(new Uint8Array(32)),\n     ttlSeconds: 600,\n   });\n   const app = new McpServer(\n     { name: 'app', version: '1.0' },\n     { requestState: { verify: codec.verify } },\n   );\n   \u002F\u002F Inside a tool handler registered on `app`:\n   return inputRequired({\n     inputRequests: { scope: inputRequired.elicit({\u002F* … *\u002F}) },\n     requestState: await codec.mint({ step: 'confirmed' }),\n   });\n   ```\n\n   **Done:** Every multi-round flow stores state in verified codec, rejects invalid state before business logic, exposes no secret in payload.\n\n4. **Report long work, honor cancellation**: Emit strictly increasing `notifications\u002Fprogress` values for one `progressToken`. Pass `ctx.mcpReq.signal` to DB\u002FHTTP work; check `signal.aborted` inside recursive work and loop conditions.\n\n   ```ts\n   async ({ files }, ctx) => {\n     const tok = ctx.mcpReq._meta?.progressToken;\n     for (let i = 0; i \u003C files.length; i++) {\n       if (tok)\n         await ctx.mcpReq.notify({\n           method: 'notifications\u002Fprogress',\n           params: { progressToken: tok, progress: i + 1, total: files.length },\n         });\n     }\n     return { content: [{ type: 'text', text: 'Done' }] };\n   };\n   ```\n\n   **Done:** Each long-running path propagates abort signal, checks it during repeated work, emits monotonic progress when caller supplied token.\n\n5. **Complete prompt arguments at schema**: Wrap prompt `argsSchema` fields with `completable(...)`. Define resource-template completion in template's `complete` map instead.\n\n   ```ts\n   import { completable } from '@modelcontextprotocol\u002Fserver';\n   server.registerPrompt(\n     'review',\n     {\n       argsSchema: z.object({\n         lang: completable(z.string(), (val) =>\n           ['ts', 'js', 'py'].filter((lang) => lang.startsWith(val)),\n         ),\n       }),\n     },\n     ({ lang }) => ({\n       messages: [{ role: 'user', content: { type: 'text', text: `Review ${lang}` } }],\n     }),\n   );\n   ```\n\n   **Done:** Every prompt argument needing completion uses `completable(...)`, every resource-template variable uses its template completion map.\n\n6. **Serve confirmed 2025 connections through legacy branch**: Require client's `elicitation` capability, use form mode for standard data, URL mode for external redirects, return from handler on `decline`\u002F`cancel`. Keep credentials, API keys out of forms. `requestedSchema` defaults JSON Schema 2020-12; declare `$schema` when porting draft-07. `ElicitResult.content` in form mode is submitted form fields as object (e.g. `{ rating: 5, comment: '…' }`) validated against `requestedSchema` — return schema-shaped object.\n\n   ```ts\n   const result = await ctx.mcpReq.elicitInput({\n     mode: 'form',\n     message: 'Rate topic',\n     requestedSchema: {\n       type: 'object',\n       properties: { rating: { type: 'number' } },\n       required: ['rating'],\n     },\n   });\n   if (result.action === 'accept') {\n     return { content: [{ type: 'text', text: `Recorded: ${JSON.stringify(result.content)}` }] };\n   }\n   ```\n\n   **Done:** Each legacy-only flow has confirmed 2025 connection, supported client capability, declared schema dialect when needed, valid result content, terminating non-accept path.\n\n7. **Retire 2025-only facilities**: Replace `ctx.mcpReq.requestSampling` with server direct-LLM-provider call only after recording provider, data-handling\u002Fretention policy, consent path, cost owner; stays functional for 2025 connections but throws for modern ones. Replace deprecated `ctx.mcpReq.log(level, data)` with stderr or OpenTelemetry.\n\n   **Done:** Each direct LLM replacement has recorded provider, privacy\u002Fconsent, cost decision; new interaction paths use neither sampling nor MCP logging; every retained legacy call isolated to confirmed 2025 branch.\n",{"name":5,"metadata":24,"description":7,"user-invocable":20},{"category":25},"technique","main","534498267dccbe415f22f31fceac9da6771c195f","plugins\u002Fmcp-hub\u002Fskills\u002Fmcp-elicitation","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace","https:\u002F\u002Fj0hanz-marketplace.vercel.app","https:\u002F\u002Fgithub.com\u002Fj0hanz","linus-johansson-cv-d308be9b73e1.herokuapp.com","2026-11-15 02:42:07",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add j0hanz\u002Fj0hanz-marketplace --skill mcp-elicitation",{"tool":40,"command":41},"bunx","bunx skills add j0hanz\u002Fj0hanz-marketplace --skill mcp-elicitation",{"tool":43,"command":44},"pnpm","pnpm dlx skills add j0hanz\u002Fj0hanz-marketplace --skill mcp-elicitation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fmcp-hub\u002Fskills\u002Fmcp-elicitation\u002FSKILL.md",true,[],[49,56,63,70,77,84],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7ABP78JFYBMCXJ9GMETCYZM","unslop","Use when writing or editing prose a person will read, or when text sounds AI-generated.","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fwriteup\u002Fskills\u002Funslop\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7ABP52BNV7NRPNBR6PCNZWC","show-me","Use when asked to show, diagram, or walk through how code fits together or what a change does, or before explaining a multi-file flow in prose.","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fwriteup\u002Fskills\u002Fshow-me\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7ABP3EPN4KFB4HPJNMY31NR","pr","Use when writing or updating a pull request description, or before running `gh pr create`.","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fwriteup\u002Fskills\u002Fpr\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7ABP08MXTHPZYTG4HKEP7WQ","commit","Use when writing a commit message, or before running `git commit`.","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fwriteup\u002Fskills\u002Fcommit\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7ABNV9J7DN1AFRBGDBHVBY2","write-specs","Spec a feature's observable behavior. Use when asked for requirements, when a request says what the system should do but not how, or to capture what a built system already guarantees. Not for how to build it (write-plan).","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fworkbench\u002Fskills\u002Fwrite-specs\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7ABNPK2GVG8EB3SSEAMK4FZ","write-skills","Write, fix, or audit a skill's frontmatter, trigger description, and body. Use when a skill is asked for, never fires, or fires at the wrong moment. Not for a hook (write-hooks) or the plugin manifest and catalog.","https:\u002F\u002Fgithub.com\u002Fj0hanz\u002Fj0hanz-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fworkbench\u002Fskills\u002Fwrite-skills\u002FSKILL.md",[],[]]