Allow omitting MCP tool prefixes per server (#34991)

## What changed

- Accept a table form of `features.non_prefixed_mcp_tool_names` with an
  optional `server_names` list while preserving the existing boolean form.
- Omit the legacy `mcp__` namespace prefix only for tools from selected MCP
  servers. When no server list is provided, the enabled feature continues to
  omit the prefix for every server.
- Cover configuration resolution, tool normalization, and an MCP stdio
  round trip with selected servers.

GitOrigin-RevId: bdfb7ac54226de5051f06610e2c6b78b23912ef0
This commit is contained in:
sayan-oai authored and copyberry committed 2026-07-23 18:54:55 +00:00
1 parent 0d4910331d
commit 74e9d7efc4
15 files changed
+437 -15

No files matched your search

@@ -110,7 +110,11 @@ impl McpConnectionSet {
.map(|tool| Self::with_server_metadata(tool, &view.metadata)),
);
}
let tools = normalize_tools_for_model_with_prefix(tools, self.prefix_mcp_tool_names);
let tools = normalize_tools_for_model_with_prefix(
tools,
self.prefix_mcp_tool_names,
&self.non_prefixed_mcp_tool_servers,
);
trace!(
available_server_count,
unavailable_server_count,
@@ -170,8 +174,11 @@ impl McpConnectionSet {
);
}
let clients = Arc::new(McpBindingClients::new(clients));
let listed_tools =
normalize_tools_for_model_with_prefix(listed_tools, self.prefix_mcp_tool_names);
let listed_tools = normalize_tools_for_model_with_prefix(
listed_tools,
self.prefix_mcp_tool_names,
&self.non_prefixed_mcp_tool_servers,
);
let mut tools = Vec::with_capacity(listed_tools.len());
let mut calls = std::collections::HashMap::with_capacity(listed_tools.len());
for tool_info in listed_tools {
@@ -298,7 +305,11 @@ impl McpConnectionSet {
)
.into_iter()
.map(|tool| Self::with_server_metadata(tool, &view.metadata));
let tools = normalize_tools_for_model_with_prefix(tools, self.prefix_mcp_tool_names);
let tools = normalize_tools_for_model_with_prefix(
tools,
self.prefix_mcp_tool_names,
&self.non_prefixed_mcp_tool_servers,
);
emit_duration(
CODEX_APPS_REFRESH_DURATION_METRIC,
refresh_start.elapsed(),