modelcontextprotocol / modelcontextprotocol/typescript-sdk
Call schema on inputSchema validation failure
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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