mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
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:
1 parent
0d4910331d
commit
74e9d7efc4
15 files changed
+437
-15
No files matched your search
@@ -109,10 +109,11 @@ pub(crate) fn filter_tools(tools: Vec<ToolInfo>, filter: &ToolFilter) -> Vec<Too
|
||||
/// every model-visible name is unique and <= 64 bytes.
|
||||
///
|
||||
/// When `prefix_mcp_tool_names` is true, the historical `mcp__` namespace
|
||||
/// prefix is added without restoring the old trailing `__` namespace suffix.
|
||||
/// prefix is added except for tools from `non_prefixed_mcp_tool_servers`.
|
||||
pub(crate) fn normalize_tools_for_model_with_prefix<I>(
|
||||
tools: I,
|
||||
prefix_mcp_tool_names: bool,
|
||||
non_prefixed_mcp_tool_servers: &[String],
|
||||
) -> Vec<ToolInfo>
|
||||
where
|
||||
I: IntoIterator<Item = ToolInfo>,
|
||||
@@ -137,7 +138,7 @@ where
|
||||
|
||||
let callable_namespace = callable_namespace_with_prefix(
|
||||
&sanitize_responses_api_tool_name(&tool.callable_namespace),
|
||||
prefix_mcp_tool_names,
|
||||
prefix_mcp_tool_names && !non_prefixed_mcp_tool_servers.contains(&tool.server_name),
|
||||
);
|
||||
|
||||
candidates.push(CallableToolCandidate {
|
||||
|
||||
Reference in new issue
Block a user