Implementation of SEP-986: Specify Format for Tool Names#900
Merged
felixweinberger merged 6 commits intomodelcontextprotocol:mainfrom Nov 11, 2025
Conversation
Contributor
Author
|
Sorry about all the changes after I opened the PR. I thought it was ready, but I guess it wasn't 😅 Should be ready to go now. |
cliffhall
reviewed
Aug 25, 2025
kentcdodds
commented
Aug 25, 2025
0546db5 to
f807421
Compare
0845a57 to
c94ba4b
Compare
5 tasks
- Add comprehensive tool name validation utility with regex patterns - Validate tool names against SEP-0001 specification requirements - Support valid characters: lowercase letters, numbers, hyphens, underscores - Enforce length limits (1-64 characters) and naming conventions - Generate appropriate warnings for non-compliant tool names - Add extensive test coverage with Jest spies for console methods - Integrate validation into McpServer.registerTool() method - Update test suite to cover all validation scenarios - Add documentation and examples for tool name validation This ensures all registered tools comply with the Model Context Protocol specification for tool naming, improving interoperability and consistency.
- Remove forward slash (/) from allowed characters - Keep 128 character limit and other restrictions - Align with final merged specification
d489d41 to
674827d
Compare
commit: |
e3e2d3f to
5cabbe7
Compare
Contributor
|
Hi @kentcdodds thanks for this - took the liberty of rebasing and updating the implementation to match the final version of modelcontextprotocol/modelcontextprotocol#986 (e.a. |
| callback: ToolCallback<ZodRawShape | undefined> | ||
| ): RegisteredTool { | ||
| // Validate tool name according to SEP specification | ||
| validateAndWarnToolName(name); |
Contributor
There was a problem hiding this comment.
this is the core change
| update: updates => { | ||
| if (typeof updates.name !== 'undefined' && updates.name !== name) { | ||
| if (typeof updates.name === 'string') { | ||
| validateAndWarnToolName(updates.name); |
Contributor
There was a problem hiding this comment.
this is the core change
Reduce test file size by 46% (109 lines) using parameterized tests. This improves readability while maintaining the same test coverage.
KKonstantinov
approved these changes
Nov 11, 2025
KKonstantinov
approved these changes
Nov 11, 2025
felixweinberger
approved these changes
Nov 11, 2025
Contributor
Author
|
Cool improvements. Thanks @felixweinberger! |
GoBeromsu
added a commit
to GoBeromsu/XM32-MCP
that referenced
this pull request
Nov 12, 2025
…ype schemas for input and output (modelcontextprotocol#900)
This was referenced Nov 18, 2025
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
modelcontextprotocol/modelcontextprotocol#986
How Has This Been Tested?
Unit tests
Breaking Changes
None, but console warnings may appear for SDK users who have names that do not satisfy the SEP.
Types of changes
Checklist
Additional context
FYI, I used Cursor background agents for this.
Very open to feedback to adjust this implementation.