feat: accept object form for toolsConfig values#1462
Merged
Conversation
A per-tool config value can now be an object ({ enabled?, description?,
maxDepth?, maxSteps? }) in addition to the existing string/boolean/null forms,
so a caller can pass a description override AND tool-specific options at once
(e.g. graph_sub_agent maxDepth/maxSteps).
Adds ToolConfigObject/ToolConfigValue types plus toolConfigEnabled() and
toolConfigDescription() helpers, and routes every toolsConfig read through them
(opt-in tools, the generic filter loop, and agent.ts). The generic loop now
also applies object description overrides and honors { enabled: false } for any
tool. Fully backwards compatible.
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.
What
toolsConfigvalues can now optionally be an object, in addition to the existingstring | boolean | nullforms. This lets a caller pass a description override and tool-specific options at once — e.g.graph_sub_agent'smaxDepth/maxSteps(follow-up to #1461).Fully backwards compatible.
truefalse"some string"null{ ... }enabled: false) + carrydescriptionand options{ "toolsConfig": { "graph_sub_agent": { "description": "Explore the graph...", "maxDepth": 3, "maxSteps": 15 }, "logs_agent": { "description": "custom desc" }, "bash": { "enabled": false } } }How
tools.ts:ToolConfigObject(enabled?,description?,maxDepth?,maxSteps?) andToolConfigValue = string | boolean | null | ToolConfigObject.toolConfigEnabled(v)— truthiness that also honors{ enabled: false }.toolConfigDescription(v)— pulls the string override orobject.description.toolsConfigread through the helpers instead of ad-hocif (toolsConfig.X)/typeof … === "string"checks: the opt-in tools (ask_clarifying_questions,logs_agent,str_replace_based_edit_tool,apply_patch,generate_*, concepts), the generic filter loop, and the 3 truthiness sites inagent.ts.{ enabled: false }for any tool.graph_sub_agentreadsmaxDepth/maxStepsfrom the object form (previously hardcoded), making recursion depth user-configurable.Testing
npx tsc --noEmitclean