v1.6.1

Tool Management Tools

Last updated


Tools that find, call, write, validate and test other tools.
ToolDescription
find_toolsThe tool registry. mode=search takes exact names in names (case-insensitive, at most 16 per call; it takes precedence over query) or, when no listed name fits, space-separated English keywords in query that must all match a tool's name or description (at most 5 tools per source: mcp, script, ext, system), and returns the matching schemas as its tool output (the tools array is never edited mid-run); mode=list returns names plus one-line descriptions with no schema injection, internal bookkeeping tools excluded. The mcp and system parameters were Removed in v1.3.5. Since v1.3.17 the generic fallback built-ins registered with SystemDefault (search_web, fetch_page, download_file, http_request, generate_image, generate_audio) carry system_default: true in search and list results and rank one point lower in query matching, and the names guidance prefers mcp__* over script_*, with system_default tools as the fallback when nothing else fits; this replaced the [system-default] description prefix (Removed in v1.3.17), which had marked search_web, fetch_page, generate_image, generate_audio, reasoning_guide, list_chatbot and send_to_chatbot. Mode is inferred: names or query → search, otherwise list. Since v1.3.7 tool descriptions are English-only, so query keywords are written in English. A capability that looks missing is checked here before anything is built
run_toolAdded in v1.2.0. Calls a tool from the per-turn Tools list by name: run_tool(name, args), with args matching that tool's schema ({} when it takes none). Every tool other than find_tools goes through it for providers other than claude-code; the runtime unpacks the call into the inner tool before confirmation and validation, and its own handler never runs. A name not fetched with find_tools first returns its schema for a re-call; an excluded or unregistered name is rejected. Not sent to claude-code
write_toolRenamed from edit_tool (Removed in v1.5.0). The tool definitions themselves. mode=write creates or overwrites, mode=patch replaces an exact string, only its first occurrence unless replace_all is set (typically after test_tool failed), mode=remove trashes the directory (recoverable from .Trash). tag picks the file: json = tool.json (schema) or script = script.py (runtime); tag=api (<name>.json, an API tool) was Removed in v1.3.2 together with API tools. Names are snake_case with no script_ prefix — the runtime adds it. Since v1.5.0 it is no longer exempt from the confirm gate: in normal mode it asks like any tool that is not read-only, while auto mode or allow this turn lets it through
validate_toolAdded in v1.6.0. Checks one script tool's format without running it and returns valid: <dir> or every issue at once, each naming the field and the rule it breaks: script.py (or script.js) present; tool.json valid JSON (a syntax error reports its line) holding only name, description, always_allow, concurrent, timeout and parameters; name snake_case, at most 121 characters (128 minus the script_ prefix the runtime adds) and equal to its directory; description present and at most 1024 characters; always_allow / concurrent booleans; timeout a positive integer of seconds; parameters a JSON Schema object with type: "object", every property typed (or enum / anyOf / oneOf), every top-level property described, every required entry present in properties, and every array given items. name is the tool directory without the script_ prefix. The model fixes each issue with write_tool(mode=patch) and validates again until valid, then runs test_tool. Runs without confirmation and concurrently
test_toolRuns a script tool's script.py in the sandbox (60 s limit) with JSON on stdin and returns its stdout, or its stderr as the error; tool.json is not checked (since v1.6.0 validate_tool does that first). The verification step after every write_tool write or patch; on failure the loop is write_tool(mode=patch) → test again. Since v1.5.0 it asks for confirmation in normal mode like write_tool