Skip to content

MCP tool names can exceed the Amazon Bedrock 64-character limit after #39594 #46188

Description

@gokmev

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?

  1. Configure Codex to use an OpenAI-compatible model gateway backed by Amazon Bedrock Runtime.
  2. Enable Codex Apps or another MCP server exposing a tool whose fully qualified model-visible name is longer than 64 characters.
  3. Start a request that includes the MCP tool definitions.
  4. 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:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIaws-bedrockIssues related to AWS Bedrock providerbugSomething isn't workingcustom-modelIssues related to custom model providers (including local models)mcpIssues related to the use of model context protocol (MCP) servers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions