Add Python POC for client-executed MCP tool search over Responses - #2765
Closed
adityachaudhry wants to merge 1 commit into
Closed
adityachaudhry wants to merge 1 commit into
adityachaudhry wants to merge 1 commit into
Conversation
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.
Summary
Add a one-file Python POC for client-executed MCP tool search through the Copilot SDK with an OpenAI BYOK provider using the Responses API.
The session starts with a deferred
openai_docsMCP server. When the model callstool_search, the SDK'stool_search_tooloverride queries that server, adds newly discovered client tools throughsession.tools.set, and returnstool_references. Subsequent tool calls are routed back to MCP. Direct CLI-managed MCP execution is rejected and detected so the sample cannot silently take a different path. A redacted wire audit checks that successful Responses requests containtool_search_callandtool_search_outputwith matchingcall_idandexecution: "client".No SDK source changes were needed: the current tool-search override, tool references, and experimental
session.tools.setRPC already support the sequence. The POC uses only the public OpenAI Docs MCP server and reads its API key fromOPENAI_API_KEY.Verification
gpt-5.6-sol, OpenAI Responses, and Copilot CLI1.0.89-1completed with a final answer, including two fresh-session repetitions and a run after review fixes./v1/responsesrequest offering nativetool_search; the next request containedtool_search_calland clienttool_search_output, whosecall_idmatched and whose tools were absent initially; later rounds containedfunction_callandfunction_call_output.python --ignore=python/e2e) with a fresh CLI cache path.py_compile, andgit diff --checkpassed.Scope and compatibility
This is an exploratory sample.
session.tools.setis experimental and was verified against CLI1.0.89-1. The runtime currently sendsstore: falseand reconstructs input on each Responses round rather than usingprevious_response_id; the tool-search and function-call item sequence still matches the direct Responses POC.Relates to #1896.