modelcontextprotocol / modelcontextprotocol/typescript-sdk

Simplify attribution of elicitation to a tool call

Open
#963 2 comments 0 reactions 1 assignee View on GitHub

@ochafik is already working on this.

Since Sep 23, 2025.

  • #1241 by @KKonstantinov — closed without merging
enhancement P3 ready for work v2
Dominant language
TypeScript
Stars
13.4k
Forks
2.2k
Avg merge
3d 15h
Merged PRs (30d)
4

Description

Currently one needs to do something like:

server.tool('elicit_inputs', 'Elicitation test tool', {}, async (_request, extra) => {
  const result = await server.server.elicitInput(
    {
      message: 'Please provide inputs for the following fields:',
      requestedSchema: ...
    },
    {
      relatedRequestId: extra.requestId,
    },
  )
  ...
})

I think we should add a zod-typed elicitInput method to tool callback extras + McpServer that then calls the low-level server's elicitInput (related to https://github.com/modelcontextprotocol/typescript-sdk/issues/662):

// Tool-related elicitation:
server.tool('elicit_inputs', 'Elicitation test tool', {}, async (_request, extra) => {
  const result = await extra.elicitInput(
      'Please provide inputs for the following fields:',
      z.object(...))
  ...
})

// Non-tool-related elicitation
setInterval(async () => {
  const {action, content} = await server.elicitInput('It has been an hour. Wanna post something?', z.object(....), {timeout: 30_000});
  if (action == 'accept) ...
}, 3_600_000);

// Note: some connections might need help to stay alive.
setInterval(() => server.ping(), 5_000);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.