modelcontextprotocol / modelcontextprotocol/typescript-sdk

Call schema on inputSchema validation failure

Open
#1,160 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted needs decision P3 v2
Dominant language
TypeScript
Stars
13.4k
Forks
2.2k
Avg merge
3d 15h
Merged PRs (30d)
4

Description

Is your feature request related to a problem? Please describe.

Currently, it's pretty hard to tie in custom logic to input schema validation. If a tool is invoked with the wrong input schema, I would like to be able to add logging logic to track this. This would be helpful for observability of my tool-calls and to better tune the tool names / params / descriptions to help with LLM usage.

Describe the solution you'd like

It would be ideal if we can specify a callback to call on input schema validation failures.

Describe alternatives you've considered

One option is to not pass in inputSchema and just completely handle input schema validation in the handler. This seems a bit unideal when the SDK already gives a more official inputSchema arg.

Another option is by intercepting the response downstream and "detecting" it's an inputSchema validation error. This also seems a bit hacky to do and at the wrong layer.

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.

Research direction

Start by tracing the SDK's inputSchema validation and handler invocation path. Define where a validation-failure callback would fit, what information it should receive, and how its behavior relates to the existing inputSchema and handler alternatives; completion requires an agreed callback API and corresponding validation coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.