Tool registration is duplicated between _TOOL_DISPATCH and _DIR_TOOLS #56
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adding a new tool the dir agent can call requires updating two places in
ai.py:_TOOL_DISPATCHatai.py:645— name → handler function_DIR_TOOLSatai.py:151— Anthropic-shaped tool schema (name, description, input_schema)Forgetting one half is silent: the agent will either see a tool it cannot dispatch (KeyError on call) or have a dispatchable tool it never knows about. Internals.md §9.1 documents this as a 5-step process per tool, which is friction.
Fix
Small registration helper, e.g.:
The decorator appends to a single registry that exposes both the dispatch dict and the schema list.
Notes
_TOOL_DISPATCHwith dynamic discovery from an MCP server. That makes this issue partially moot — the duplication problem evaporates once tools come from the server. Two options: