Encapsulate tool search entries in handlers#22261
Merged
Merged
Conversation
…-tool-spec-refactor # Conflicts: # codex-rs/core/src/tools/registry.rs # codex-rs/core/src/tools/spec_plan.rs
…c' into pakrym/code-mode-remove-find-spec
…-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
478436b to
afaf3ae
Compare
…-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
Contributor
There was a problem hiding this comment.
💡 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".
pakrym-oai
commented
May 13, 2026
| use std::collections::BTreeMap; | ||
|
|
||
| #[test] | ||
| fn search_info_uses_mcp_tool_metadata_and_parameter_names() { |
Collaborator
Author
There was a problem hiding this comment.
I claim this is a useful unit test :)
sayan-oai
approved these changes
May 13, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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_entriespath; it can collect searchable entries from deferred handlers directly.What changed
search_info()to tool handlers and implemented it for MCP and dynamic handlers.spec()output when constructing tool-search entries, adapting it into the deferredLoadableToolSpecshape expected bytool_search.build_tool_registry_builder(...)sotool_searchregistration is based on deferred handlers with search info.codex-toolsdiscovery helper exports.Verification
cargo test -p codex-core tools::handlers::tool_search::tests:: -- --nocapturecargo test -p codex-core tools::spec_plan::tests::search_tool -- --nocapturecargo test -p codex-core tools::spec::tests:: -- --nocapturecargo test -p codex-core tools::spec_plan::tests:: -- --nocapturecargo test -p codex-toolsjust fix -p codex-corejust fix -p codex-tools