mirror of
https://github.com/openai/codex.git
synced 2026-11-17 14:58:36 +00:00
Add per-surface MCP tool exposure controls (#36781)
## Why MCP tools can be exposed directly, discovered through tool search, or called from Code Mode. Servers need to be able to opt out of any of these surfaces without disabling their tools everywhere. ## What changed - Add `omit_tools_from` to MCP server configuration, accepting any combination of `direct`, `deferred`, and `code_mode`. - Apply the exclusions independently when building direct, deferred, and Code Mode tool surfaces while keeping omitted tools registered for permitted uses. - Remove client-private `_meta` fields from MCP results returned to Code Mode. - Include the new setting in the configuration schema and MCP config serialization. ## Testing - Cover every exposure combination across Code Mode, Code-Mode-only sessions, tool search, direct-only namespaces, and prefixed and unprefixed MCP names. - Verify direct and nested execution paths, parallel-call support, config round-tripping, and `_meta` filtering. GitOrigin-RevId: 12dfcb78bb5c5ecf4d70f38a8b5022792463a27f
This commit is contained in:
1 parent
136f75e7b7
commit
51c9ed6d4f
41 files changed
+981
-20
No files matched your search
@@ -180,9 +180,14 @@ impl ToolOutput for codex_protocol::mcp::CallToolResult {
|
||||
}
|
||||
|
||||
fn code_mode_result(&self, _payload: &ToolPayload) -> JsonValue {
|
||||
serde_json::to_value(self).unwrap_or_else(|err| {
|
||||
let mut result = serde_json::to_value(self).unwrap_or_else(|err| {
|
||||
JsonValue::String(format!("failed to serialize mcp result: {err}"))
|
||||
})
|
||||
});
|
||||
// MCP result metadata is private to clients and must not reach Code Mode.
|
||||
if let JsonValue::Object(fields) = &mut result {
|
||||
fields.remove("_meta");
|
||||
}
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user