Skip to content

feat(core): support lazy tool search registration#25211

Draft
fcoury-oai wants to merge 1 commit into
fcoury/hide-mcp-3-explicit-readinessfrom
fcoury/hide-mcp-4-lazy-tool-registry
Draft

feat(core): support lazy tool search registration#25211
fcoury-oai wants to merge 1 commit into
fcoury/hide-mcp-3-explicit-readinessfrom
fcoury/hide-mcp-4-lazy-tool-registry

Conversation

@fcoury-oai
Copy link
Copy Markdown
Contributor

@fcoury-oai fcoury-oai commented May 30, 2026

Why

tool_search needs a reusable way to surface tools discovered after a turn starts and dispatch a returned MCP tool immediately. This infrastructure should be reviewable separately from the MCP startup policy that supplies the loaders.

What Changed

  • Add a lazy tool registry alongside the static registry.
  • Allow tool_search to refresh optional MCP search entries through injected loaders.
  • Register only returned lazy MCP handlers so they can be called during the same turn.
  • Rebuild normalized MCP entries together when inventory changes.
  • Reject lazily loaded tools shadowed by existing static handlers while preserving equivalent static MCP handlers.

This layer is dormant until a caller supplies lazy MCP loaders.

Stack

  1. #25212 background MCP startup status
  2. #25213 atomic startup header handoff
  3. #25214 explicit MCP dependency readiness
  4. feat(core): support lazy tool search registration #25211 lazy tool-search registration (this PR)
  5. #24987 pending MCP inventory integration

How to Test

Targeted tests:

  • just test -p codex-core lazy_mcp_search

The focused run covers same-turn dispatch registration, pending-loader avoidance when existing results match, ready-tool refresh, normalized-name replacement, and shadow handling.

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