MCP tool names can exceed the Amazon Bedrock 64-character limit after #39594
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
What issue are you seeing?
Codex can generate model-visible MCP tool names longer than the 64-character maximum accepted by Amazon Bedrock Runtime.
PR #39594 raised MAX_TOOL_NAME_LENGTH from 64 to 128 bytes to match the OpenAI Responses API. When Codex uses an OpenAI-compatible gateway that forwards requests to Bedrock, MCP tool names between 65 and 128 characters now pass Codex normalization but are rejected downstream by Bedrock.
This is especially easy to encounter with Codex Apps because the mcp__codex_apps__ namespace consumes 17 characters before the individual tool name is appended.
AWS documents a maximum tool-name length of 64 characters:
https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ToolSpecification.html
What steps can reproduce the bug?
- Configure Codex to use an OpenAI-compatible model gateway backed by Amazon Bedrock Runtime.
- Enable Codex Apps or another MCP server exposing a tool whose fully qualified model-visible name is longer than 64 characters.
- Start a request that includes the MCP tool definitions.
- Observe that Codex accepts and forwards the tool name, but the Bedrock-backed request is rejected because the tool name exceeds 64 characters.
This behavior is present in Codex CLI 0.153.2. Version 0.148.0 still normalized names to at most 64 bytes; version 0.149.0 contains the change to 128 bytes.
What is the expected behavior?
Codex should keep model-visible tool names within the limit supported by the selected provider. A provider-specific or configurable maximum tool-name length would allow OpenAI Responses API providers to use 128 bytes while Bedrock-backed providers continue using 64.
Shortened names should retain deterministic hashing and collision handling so that calls can be mapped back to the original MCP server and tool.
Additional information
The original 64-character MCP name handling was introduced for #1289 by #1571. PR #39594 later raised the limit from 64 to 128 bytes specifically for the Responses API.
Current workaround: place a proxy between Codex and the gateway that deterministically shortens tool names to 64 characters and reverses the mapping for returned tool calls.
References:
- Original issue: #1289
- Original fix: #1571
- Limit increase: #39594
- AWS Bedrock ToolSpecification constraints: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ToolSpecification.html
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the MCP tool-name normalization change from PR #39594 and reviewing its related tests. Compare the 64-byte Bedrock constraint with the 128-byte Responses API behavior, then verify that the chosen provider limit, deterministic hashing, collision handling, and reverse mapping work for both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, rust
- Domain
- api, backend-api-design, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100