Repository navigation
Offer tools in a stable order: by topic, then each MCP server's as listed - #299
Merged
Merged
Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ToolRegistrykept its tools in aHashMap, so they reached the model in an order that differed for every new registry. The registry is rebuilt at the start of each agent run, and tools come first in the prefix prompt caches key on. A changed order would therefore miss the cache on a run's first request. I read this from the code and did not measure it. The same randomness is whytest_tool_use_docs_generationonly failed now and then (fixed in #298).The order now
toolsis anIndexMap, so tools stay in registration order. Replacing a tool or adding a capability tag does not move it.register_default_toolsregisters them by topic: finding and reading, changing files, running commands, the web and browser, the agent's own work, earlier sessions, skills.ask_questionfollows where it is offered.BTreeMap, so alphabetical by name) and each server's tools aslist_toolsreturns them.The xml and caret tool docs follow the same order, since they read the same definitions.
Testing
cargo test --workspace, clippy with-D warnings, the format check andcargo deny checkpass locally.The first request after this ships sees a new tool order once, so it misses the cache as usual after any prompt change.