Skip to content

Sanitize MCP tool names and release 2.0.1 - #4

Merged
arterialist merged 1 commit into
mainfrom
feat/tool-name-sanitization
Aug 29, 2026
Merged

arterialist merged 1 commit into
mainfrom
feat/tool-name-sanitization

Conversation

@arterialist

Copy link
Copy Markdown
Collaborator

What changed

  • Sanitize LLM-facing MCP tool names to the OpenRouter-safe character set.
  • Enforce a valid leading character, 64-character maximum, and deterministic uniqueness.
  • Preserve original MCP names for tools/call routing.
  • Always namespace duplicate server/tool names; remove the unsafe collision opt-out.
  • Bump the package to 2.0.1 and document the behavior.

Why

MCP tool names can be valid under the MCP naming guidance while still being rejected by OpenRouter-backed providers. The previous collision flag also did not protect duplicate tool names: duplicate exposed names could overwrite the routing map. This keeps provider-facing names safe while retaining the raw server names for dispatch.

Verification

  • Full test suite: 88 passed.
  • Package build produced mcphero-2.0.1.tar.gz and mcphero-2.0.1-py3-none-any.whl.
  • Ruff format checks passed for mcphero and tests.
  • Ruff checks passed for the changed test files.
  • Basedpyright passed on changed Python files with 0 errors, warnings, or notes.
  • git diff --check passed.

The repository's full Ruff check still reports four pre-existing findings in unchanged lines of mcphero/adapters/base_adapter.py; they are outside this patch.

@arterialist
arterialist requested a review from stepacool August 5, 2026 10:55
@arterialist
arterialist marked this pull request as ready for review August 5, 2026 10:57
@arterialist
arterialist merged commit ae96780 into main Aug 29, 2026
5 checks passed
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.

1 participant