Repository navigation
docs: say that a spec handler's params drop members the spec does not define - #3087
Conversation
… define Refs #3008. A handler registered with `setRequestHandler('tools/call', handler)` receives the request parsed with the spec schema, so a member next to `name` and `arguments` does not reach it. The low-level server page now says so.
|
@modelcontextprotocol/client
@modelcontextprotocol/codemod
@modelcontextprotocol/core
@modelcontextprotocol/server
@modelcontextprotocol/server-legacy
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
There was a problem hiding this comment.
I reviewed this docs-only PR and found no bugs; the new callout matches what the code does. Because .github/CODEOWNERS assigns every path to the typescript-sdk team, a code-owner look is still worthwhile.
What was reviewed:
- Traced the 2-arg
setRequestHandlerpath inpackages/core-internal/src/shared/protocol.ts: the handler receives the output of the era codec'svalidateRequest, not the raw request. - Checked the
tools/callparams schema in both wire revisions (rev2025-11-25and therev2026-07-28dispatch schema): both are plainz.object, so an undeclared sibling ofnameandargumentsis stripped rather than rejected or passed through. - Ruled out a conflict with
params._meta: extension keys there do reach the handler, but_metais a spec-defined member and the callout only speaks of members next tonameandarguments.
Extended reasoning...
The change adds a four-line VitePress ::: info callout to docs/advanced/low-level-server.md and touches no code, tests or changesets, so it has no security-sensitive surface. The factual claim holds in the source: spec-method handlers get the schema-parsed request, and the tools/call params object is non-loose in both wire revisions, so unknown members are stripped. No findings were reported and there are no outstanding reviewer objections on the timeline. The only thing deciding defer over approve is that .github/CODEOWNERS has a catch-all rule making the changed path code-owned.
Requested by Felix Weinberger · Slack thread
Refs #3008.
A handler registered with
setRequestHandler('tools/call', handler)receives the request parsed with the spec schema, so a member next tonameandargumentsdoes not reach it. The low-level server page now says so.Generated by Claude Code