-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Implementation of SEP-986: Specify Format for Tool Names #900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Implementation of SEP-986: Specify Format for Tool Names #900
Conversation
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. |
src/shared/toolNameValidation.ts
Outdated
} | ||
console.warn("Tool registration will proceed, but this may cause compatibility issues."); | ||
console.warn("Consider updating the tool name to conform to the MCP tool naming standard."); | ||
console.warn("See SEP: Specify Format for Tool Names for more details."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider including a URL to this SEP here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea 👍 Done.
- 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.
0546db5
to
f807421
Compare
0845a57
to
c94ba4b
Compare
- Adjusted validation logic and regex to accept tool names between 1 and 64 characters - Updated test cases to reflect new character length requirements - Modified warnings to align with the updated maximum length modelcontextprotocol/modelcontextprotocol#986 (comment)
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.