[code mode] defer mcp tools from exec description#17287
Draft
sayan-oai wants to merge 6 commits intodev/sayan/namespace-refactor-2from
Draft
[code mode] defer mcp tools from exec description#17287sayan-oai wants to merge 6 commits intodev/sayan/namespace-refactor-2from
sayan-oai wants to merge 6 commits intodev/sayan/namespace-refactor-2from
Conversation
pakrym-oai
reviewed
Apr 10, 2026
pakrym-oai
reviewed
Apr 10, 2026
sayan-oai
commented
Apr 10, 2026
Comment on lines
+287
to
+295
| let call = if let Some(mcp_tool_call) = tool_runtime.resolve_mcp_tool_call(&tool_name).await { | ||
| match serialize_function_tool_arguments(&tool_name, input) { | ||
| Ok(raw_arguments) => ToolCall { | ||
| tool_name: mcp_tool_call.dispatch_name, | ||
| call_id, | ||
| tool_namespace: mcp_tool_call.dispatch_namespace, | ||
| payload: ToolPayload::Mcp { | ||
| server: mcp_tool_call.tool_info.server_name, | ||
| tool: mcp_tool_call.tool_info.tool.name.to_string(), |
Collaborator
Author
There was a problem hiding this comment.
we have to do this because directly accessible mcp tools are keyed in the registry as {qualified_tool_name} (i.e. mcp__ologs__get_logs), but deferred mcp tools are keyed as {namespace}:{name} (i.e. mcp__ologs__:get_logs).
this is because responsesapi's tool_search returns namespaced tools, but that concept is not required for MCPs otherwise. since MCPs can now be discovered via tool_search, we have to support both, but right now they are not uniform and this is a headache for callers.
I think it'd make sense to register all MCPs with namespaces to simplify.
6dac0a1 to
388d9d5
Compare
0dec148 to
558bd7f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP
in non-code-mode, all MCP tools (custom and app-contributed) are hidden behind
tool_searchnow to avoid context bloat.In
code_mode_onlyhowever, all tools, including MCP tools, are added to the description of theexectool, causing bloat.This change hides them from the description but keeps them in
ALL_TOOLSand as runtime-callable. It adds instructions telling the model to write code to search overALL_TOOLSto find the MCP tools it wants.Will explore adding a
searchTools()fn to code mode as a more polished version (so the model doesn't have to write code every time), as the normal responsesapi one is not present in code mode.Tests
added regression test, testing locally.