Skip to content

feat: search_tool#10657

Open
apanasenko-oai wants to merge 2 commits intomainfrom
anton_panasenko_search_tool
Open

feat: search_tool#10657
apanasenko-oai wants to merge 2 commits intomainfrom
anton_panasenko_search_tool

Conversation

@apanasenko-oai
Copy link
Collaborator

@apanasenko-oai apanasenko-oai commented Feb 4, 2026

Why We Did This

  • The goal is to reduce MCP tool context pollution by not exposing the full MCP tool list up front
  • It forces an explicit discovery step (search_tool_bm25) so the model narrows tool scope before making MCP calls, which helps relevance and lowers prompt/tool clutter.

What It Changed

  • Added a new experimental feature flag search_tool in core/src/features.rs:90 and core/src/features.rs:430.
  • Added config/schema support for that flag in core/config.schema.json:214 and core/config.schema.json:1235.
  • Added BM25 dependency (bm25) in Cargo.toml:129 and core/Cargo.toml:23.
  • Added new tool handler search_tool_bm25 in core/src/tools/handlers/search_tool_bm25.rs:18.
  • Registered the handler and tool spec in core/src/tools/handlers/mod.rs:11 and core/src/tools/spec.rs:780 and core/src/tools/spec.rs:1344.
  • Extended ToolsConfig to carry search_tool enablement in core/src/tools/spec.rs:32 and core/src/tools/spec.rs:56.
  • Injected dedicated developer instructions for tool-discovery workflow in core/src/codex.rs:483 and core/src/codex.rs:1976, using core/templates/search_tool/developer_instructions.md:1.
  • Added session state to store one-shot selected MCP tools in core/src/state/session.rs:27 and core/src/state/session.rs:131.
  • Added filtering so when feature is enabled, only selected MCP tools are exposed on the next request (then consumed) in core/src/codex.rs:3800 and core/src/codex.rs:3843.
  • Added E2E suite coverage for enablement/instructions/hide-until-search/one-turn-selection in core/tests/suite/search_tool.rs:72, core/tests/suite/search_tool.rs:109, core/tests/suite/search_tool.rs:147, and core/tests/suite/search_tool.rs:218.
  • Refactored test helper utilities to support config-driven tool collection in core/tests/suite/tools.rs:281.

Net Behavioral Effect

  • With search_tool off: existing MCP behavior (tools exposed normally).
  • With search_tool on: MCP tools start hidden, model must call search_tool_bm25, and only returned selected_tools are available for the next model call.

@apanasenko-oai apanasenko-oai force-pushed the anton_panasenko_search_tool branch 2 times, most recently from 7f1e5ce to 4ca5bdf Compare February 4, 2026 21:07
@apanasenko-oai apanasenko-oai marked this pull request as ready for review February 4, 2026 21:14
Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ca5bdfe6c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@apanasenko-oai apanasenko-oai force-pushed the anton_panasenko_search_tool branch from 50f11ae to f4eec12 Compare February 5, 2026 06:09
@apanasenko-oai apanasenko-oai force-pushed the anton_panasenko_search_tool branch from f4eec12 to beba899 Compare February 5, 2026 06:17
@apanasenko-oai apanasenko-oai force-pushed the anton_panasenko_search_tool branch from beba899 to e61e0cd Compare February 5, 2026 06:30
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