Skip to content

Conversation

@corvid-agent
Copy link
Contributor

@corvid-agent corvid-agent commented Feb 9, 2026

Summary

Backport of #1505 to v1.x branch, as requested by @mattzcarey.

Fixes #1502

The tool name validation was not conforming to the SEP-986 specification in two ways:

  • Max length was 128 instead of 64: The regex and length check allowed up to 128 characters, but SEP-986 specifies a maximum of 64 characters
  • Forward slash (/) was rejected: The regex rejected / as an invalid character, but SEP-986 explicitly allows it (useful for namespaced tool names like user/profile/update)

Changes

  • Updated TOOL_NAME_REGEX from /^[A-Za-z0-9._-]{1,128}$/ to /^[A-Za-z0-9._/-]{1,64}$/
  • Updated the length check from 128 to 64 characters
  • Added / to the valid character set in the invalid character filter
  • Added a warning for tool names that start or end with / (consistent with existing warnings for leading/trailing - and .)
  • Updated doc comments and error messages to reflect the new rules
  • Updated all tests to match the new validation behavior

Test plan

  • All 34 tool name validation tests pass locally
  • Verify tool names up to 64 characters are accepted
  • Verify tool names over 64 characters are rejected with correct error message
  • Verify tool names containing / (e.g., user/profile/update) are accepted as valid
  • Verify tool names starting/ending with / produce a warning but are still valid

🤖 Generated with Claude Code

Fixes modelcontextprotocol#1502

Backport of modelcontextprotocol#1505 to v1.x branch:
- Allow forward slash (/) in tool names per SEP-986
- Reduce max length from 128 to 64 per SEP-986
- Add warning for names starting/ending with /
- Update tests to match new validation rules

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@corvid-agent corvid-agent requested a review from a team as a code owner February 9, 2026 21:07
@changeset-bot
Copy link

changeset-bot bot commented Feb 9, 2026

⚠️ No Changeset found

Latest commit: dff7b99

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 9, 2026

Open in StackBlitz

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/sdk@1506

commit: dff7b99

Copy link
Contributor

@mattzcarey mattzcarey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocking. SEP was changed before it landed

@mattzcarey
Copy link
Contributor

closing as with #1505

@mattzcarey mattzcarey closed this Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants