Skip to content

Add Python POC for client-executed MCP tool search over Responses - #2765

Closed
adityachaudhry wants to merge 1 commit into
github:mainfrom
adityachaudhry:codex/ghcp-client-tool-search-poc
Closed

adityachaudhry wants to merge 1 commit into
github:mainfrom
adityachaudhry:codex/ghcp-client-tool-search-poc

Conversation

@adityachaudhry

Copy link
Copy Markdown

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_docs MCP server. When the model calls tool_search, the SDK's tool_search_tool override queries that server, adds newly discovered client tools through session.tools.set, and returns tool_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 contain tool_search_call and tool_search_output with matching call_id and execution: "client".

No SDK source changes were needed: the current tool-search override, tool references, and experimental session.tools.set RPC already support the sequence. The POC uses only the public OpenAI Docs MCP server and reads its API key from OPENAI_API_KEY.

Verification

  • Repeated live runs with gpt-5.6-sol, OpenAI Responses, and Copilot CLI 1.0.89-1 completed with a final answer, including two fresh-session repetitions and a run after review fixes.
  • Wire traces showed the initial /v1/responses request offering native tool_search; the next request contained tool_search_call and client tool_search_output, whose call_id matched and whose tools were absent initially; later rounds contained function_call and function_call_output.
  • Python unit suite: 577 passed (python --ignore=python/e2e) with a fresh CLI cache path.
  • Ruff lint and format checks, py_compile, and git diff --check passed.

Scope and compatibility

This is an exploratory sample. session.tools.set is experimental and was verified against CLI 1.0.89-1. The runtime currently sends store: false and reconstructs input on each Responses round rather than using previous_response_id; the tool-search and function-call item sequence still matches the direct Responses POC.

Relates to #1896.

@adityachaudhry
adityachaudhry deleted the codex/ghcp-client-tool-search-poc branch September 24, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant