mirror of
https://github.com/openai/codex.git
synced 2026-11-22 15:15:18 +00:00
Raise the MCP tool name limit to 128 bytes (#39594)
## Why The Responses API accepts tool names up to 128 bytes, but MCP tool name normalization limited model-visible names to 64 bytes. ## What changed - Preserve MCP tool names up to the 128-byte Responses API limit. - Continue shortening and hashing names that exceed the limit so generated names remain bounded and unique. ## Testing - Cover names at the 128-byte boundary and immediately above it. - Verify distinct long names remain 128 bytes and code-mode compatible. GitOrigin-RevId: 75544d00e75dd0e9328b3e2ac763d26f9cc99a48
This commit is contained in:
1 parent
493e0efb7b
commit
1bfabb21fe
2 files changed
+30
-11
No files matched your search
@@ -106,7 +106,7 @@ pub(crate) fn filter_tools(tools: Vec<ToolInfo>, filter: &ToolFilter) -> Vec<Too
|
||||
///
|
||||
/// Raw MCP server/tool names are kept on each [`ToolInfo`] for protocol calls, while
|
||||
/// `callable_namespace` / `callable_name` are sanitized and, when necessary, hashed so
|
||||
/// every model-visible name is unique and <= 64 bytes.
|
||||
/// every model-visible name is unique and <= 128 bytes.
|
||||
///
|
||||
/// When `prefix_mcp_tool_names` is true, the historical `mcp__` namespace
|
||||
/// prefix is added except for tools from `non_prefixed_mcp_tool_servers`.
|
||||
@@ -223,7 +223,7 @@ struct CallableToolCandidate {
|
||||
}
|
||||
|
||||
const MCP_TOOL_NAME_DELIMITER: &str = "__";
|
||||
const MAX_TOOL_NAME_LENGTH: usize = 64;
|
||||
const MAX_TOOL_NAME_LENGTH: usize = 128;
|
||||
const CALLABLE_NAME_HASH_LEN: usize = 12;
|
||||
fn callable_namespace_with_prefix(namespace: &str, prefix_mcp_tool_names: bool) -> String {
|
||||
if !prefix_mcp_tool_names || namespace.starts_with(LEGACY_MCP_TOOL_NAME_PREFIX) {
|
||||
|
||||
Reference in new issue
Block a user