feat: add tool name aliasing for Bedrock compatibility#1185
Closed
NickNYU wants to merge 2 commits intoChromeDevTools:mainfrom
Closed
feat: add tool name aliasing for Bedrock compatibility#1185NickNYU wants to merge 2 commits intoChromeDevTools:mainfrom
NickNYU wants to merge 2 commits intoChromeDevTools:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
4aba578 to
f983747
Compare
Some LLM providers (e.g., AWS Bedrock) enforce a 64-character limit on tool names. When MCP clients add prefixes like `mcp__plugin_<pkg>_<server>__`, the full tool name can exceed this limit. Add a `--max-tool-name-length` CLI option that enables deterministic, collision-safe shortening of tool names using human-readable abbreviations. Internal handler dispatch, logging, and telemetry continue using the original names.
The `has all tools` e2e test dynamically imports all files in build/src/tools/ and invokes exported functions as tool factories. The ToolNameAliaser class export needs to be skipped like ToolDefinition.
f983747 to
0062a8f
Compare
Lightning00Blade
requested changes
Mar 20, 2026
Collaborator
Lightning00Blade
left a comment
There was a problem hiding this comment.
Tentatively blocking this, reasoning:
- MCP spec clearly states max tool name is 128, this is only for the name not prefixed.
- Claude should fix this on their end, as tomorrow they may break it even with this fix.
- There may drop in quality due to the new naming:
For instanceinsis confused withHTML <ins> Tag. Orinstis confused withinstance.
Collaborator
|
Agree with #1185 (review) |
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.
Summary
--max-tool-name-lengthCLI option that enables deterministic, collision-safe shortening of MCP tool namesToolNameAliaserclass using a human-readable abbreviation dictionary (e.g.,performance→perf,console→cons) with progressive truncation fallbacktoolSpec.namelimit when MCP client prefixes (e.g.,mcp__plugin_chrome-devtools-mcp_chrome-devtools__, 49 chars) push tool names over the limitProblem
When used via MCP clients that add prefixes, several tool names exceed Bedrock's 64-char limit:
performance_analyze_insightperformance_start_tracelist_console_messageslist_network_requeststake_memory_snapshotSolution
With
--max-tool-name-length 15, all names are shortened to fit:performance_analyze_insightperf_anlz_insperformance_start_traceperf_star_tracelist_console_messageslist_cons_msgstake_memory_snapshottake_mem_snapDesign
Files changed
src/tools/tool-name-aliaser.tsToolNameAliaserclasssrc/index.tssrc/bin/chrome-devtools-mcp-cli-options.ts--max-tool-name-lengthCLI optiontests/tools/tool-name-aliaser.test.tsTest plan
node --test build/tests/tools/tool-name-aliaser.test.ts)tsc --noEmit)--max-tool-name-length 15🤖 Generated with Claude Code