Skip to content

Encapsulate tool search entries in handlers#22261

Merged
pakrym-oai merged 33 commits into
mainfrom
pakrym/search-entries-from-handlers
May 13, 2026
Merged

Encapsulate tool search entries in handlers#22261
pakrym-oai merged 33 commits into
mainfrom
pakrym/search-entries-from-handlers

Conversation

@pakrym-oai
Copy link
Copy Markdown
Collaborator

Why

This builds on the handler-owned spec refactor by moving deferred tool-search metadata to the same handlers that already own tool specs. The registry builder no longer needs a separate prebuilt tool_search_entries path; it can collect searchable entries from deferred handlers directly.

What changed

  • Added search_info() to tool handlers and implemented it for MCP and dynamic handlers.
  • Reused handler spec() output when constructing tool-search entries, adapting it into the deferred LoadableToolSpec shape expected by tool_search.
  • Simplified build_tool_registry_builder(...) so tool_search registration is based on deferred handlers with search info.
  • Removed the old standalone search-entry builders and now-unused codex-tools discovery helper exports.

Verification

  • cargo test -p codex-core tools::handlers::tool_search::tests:: -- --nocapture
  • cargo test -p codex-core tools::spec_plan::tests::search_tool -- --nocapture
  • cargo test -p codex-core tools::spec::tests:: -- --nocapture
  • cargo test -p codex-core tools::spec_plan::tests:: -- --nocapture
  • cargo test -p codex-tools
  • just fix -p codex-core
  • just fix -p codex-tools

pakrym-oai added 23 commits May 11, 2026 21:18
…-tool-spec-refactor

# Conflicts:
#	codex-rs/core/src/tools/registry.rs
#	codex-rs/core/src/tools/spec_plan.rs
…-tool-spec-refactor

# Conflicts:
#	codex-rs/core/src/tools/handlers/dynamic.rs
#	codex-rs/core/src/tools/router_tests.rs
…l-spec-refactor

# Conflicts:
#	codex-rs/core/src/tools/code_mode/mod.rs
#	codex-rs/core/src/tools/router_tests.rs
@pakrym-oai pakrym-oai force-pushed the pakrym/search-entries-from-handlers branch from 478436b to afaf3ae Compare May 13, 2026 00:02
Base automatically changed from pakrym/namespaced-tool-spec-refactor to main May 13, 2026 00:09
…-from-handlers

# Conflicts:
#	codex-rs/core/src/tools/handlers/dynamic.rs
#	codex-rs/core/src/tools/handlers/mcp.rs
#	codex-rs/core/src/tools/registry.rs
#	codex-rs/core/src/tools/spec.rs
#	codex-rs/core/src/tools/spec_plan.rs
#	codex-rs/core/src/tools/spec_tests.rs
#	codex-rs/core/src/tools/tool_search_entry.rs
…-from-handlers

# Conflicts:
#	codex-rs/core/src/tools/handlers/tool_search.rs
#	codex-rs/core/src/tools/tool_search_entry.rs
@pakrym-oai pakrym-oai marked this pull request as ready for review May 13, 2026 00:54
@pakrym-oai pakrym-oai requested a review from a team as a code owner May 13, 2026 00:54
Copy link
Copy Markdown
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: f7d4c534c3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/core/src/tools/handlers/mcp.rs
use std::collections::BTreeMap;

#[test]
fn search_info_uses_mcp_tool_metadata_and_parameter_names() {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I claim this is a useful unit test :)

@pakrym-oai pakrym-oai merged commit 104fc14 into main May 13, 2026
27 checks passed
@pakrym-oai pakrym-oai deleted the pakrym/search-entries-from-handlers branch May 13, 2026 03:48
@github-actions github-actions Bot locked and limited conversation to collaborators May 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants