The tool command declares custom agent tools whose implementation is a shell command.
The tool command manages custom agent tools: tools the model can call whose implementation is a shell command. This is how a plugin ships a tool, the same way it ships a provider. For a gentler walkthrough, see Tool Plugins.
Usage: tool [command]Available Commands: add Add or update a tool action Add or update an action of a tool remove Remove a tool rm Alias for removeIn JSON, tools live under the top-level custom_tools object, keyed by name.
tool add
Add a tool, or update an existing tool with the same name.
Usage: tool add <name> --description <text> --command <command> [flags]Flags: --description string what the tool does, shown to the model (required) --command string shell command run on every call (required unless every action has its own) --param NAME DESC a string parameter (repeatable) --schema JSON a full JSON Schema object instead of --param --required string a parameter the model must supply (repeatable) --timeout int timeout in seconds (default 60) --env KEY VALUE extra environment for the command (repeatable) --skip-permission bool run calls without asking --title TEMPLATE name a call is shown with in the chat --summary TEMPLATE one-line description a call is shown with --disabled bool hide the tool from agentstool add jira_search \ --description "Search Jira issues with a JQL query" \ --param jql "The JQL query" --required jql \ --command 'curl -fsS -G -H "Authorization: Bearer $JIRA_TOKEN" --data-urlencode "jql=$jql" https://jira.example.com/rest/api/2/search'{ "custom_tools": { "jira_search": { "description": "Search Jira issues with a JQL query", "params": { "jql": "The JQL query" }, "required": ["jql"], "command": "curl -fsS -G -H \"Authorization: Bearer $JIRA_TOKEN\" --data-urlencode \"jql=$jql\" https://jira.example.com/rest/api/2/search" } }}The flags map to JSON fields of the same name, with two exceptions: --param fills the params object and --skip-permission is skip_permission. --required appends to the required array, and --env fills the env object.
When the agent calls the tool:
The command runs in the embedded shell, in the project directory. Every declared parameter is a shell variable of the same name (
$jql), empty when the model leaves it out. Values are quoted, so input is never run as code. The raw JSON input is also on stdin.The environment carries
CRUSH_TOOL_NAME,CRUSH_TOOL_ACTION(with actions),CRUSH_TOOL_INPUT(the JSON),CRUSH_SESSION_ID,CRUSH_PROJECT_DIR,CRUSH_VERSION, and, when a plugin declared it,CRUSH_PLUGIN_FILEandCRUSH_PLUGIN_DIR.Stdout is the result. A non-zero exit is reported to the model as an error with the exit code, stderr, and stdout. A call past its timeout is stopped.
Calls ask for permission, like an MCP tool, unless the tool or action says
--skip-permission true.permissions allow <name>pre-approves the whole tool,permissions allow <name>:<action>one action, andpermissions deny <name>hides it (see Permissions). PreToolUse hooks run for it like any other tool.The permission prompt leads with the call's title and summary (see How calls look in the chat) and the action's description, then lists the parameters, full values included, and the command that will run. "Allow for Session" approves that one action for the rest of the session, not the whole tool.
Only the coder agent gets custom tools; the read-only task and plan agents do not.
Validation
A broken declaration fails the load, naming the tool:
A tool name must match
^[a-zA-Z_][a-zA-Z0-9_-]{0,63}$, must not be a built-in tool's, and must not start withmcp_.A description is required, and so is a command, unless every action has its own.
Parameter and action names must be lowercase shell identifiers (
^[a-z_][a-z0-9_]*$), and every--requiredname must be declared.--schemaand--paramcan't be combined, and neither can--schemaand actions. A schema needs apropertiesobject; each property must be an object named like^[a-zA-Z0-9_.-]{1,64}$, and itstype, if set, a JSON Schema type.A tool with actions can't declare a parameter named
action; that name is reserved for picking one.A
--titleor--summarytemplate that does not parse fails the load.
A later config can tweak a plugin's tool (tool add jira_search --timeout 120) or turn it off (--disabled true) without repeating it. Such settings for a tool nothing declares, say after its plugin is removed, are ignored with a warning.
tool action
Give a tool named operations. The model picks one with an action parameter, and Crush writes the list of actions and their parameters into the tool's description, so one tool can cover a whole CLI. Each action has its own command and its own permission: reads can skip the prompt while writes still ask.
Usage: tool action <tool> <action> --description <text> [flags]Flags: --description string what the action does (required) --command string shell command for this action (default: the tool's command, with $action set) --param NAME DESC a parameter only this action uses (repeatable) --required string a parameter this action needs (repeatable) --skip-permission bool run this action without asking --title TEMPLATE overrides the tool's --title for this action --summary TEMPLATE overrides the tool's --summary for this actiontool add GitHub --description "Work with GitHub through the gh CLI" \ --param repo "OWNER/REPO; defaults to the project's repository" tool action GitHub pr_view --description "Show a pull request" \ --param number "Pull request number" --required number \ --skip-permission true \ --command 'gh pr view "$number" ${repo:+-R "$repo"}' tool action GitHub pr_comment --description "Comment on a pull request" \ --param number "Pull request number" --required number \ --param body "The comment" --required body \ --command 'printf "%s" "$body" | gh pr comment "$number" ${repo:+-R "$repo"} -F -'{ "custom_tools": { "GitHub": { "description": "Work with GitHub through the gh CLI", "params": { "repo": "OWNER/REPO; defaults to the project's repository" }, "actions": { "pr_view": { "description": "Show a pull request", "params": { "number": "Pull request number" }, "required": ["number"], "skip_permission": true, "command": "gh pr view \"$number\" ${repo:+-R \"$repo\"}" }, "pr_comment": { "description": "Comment on a pull request", "params": { "number": "Pull request number", "body": "The comment" }, "required": ["number", "body"], "command": "printf \"%s\" \"$body\" | gh pr comment \"$number\" ${repo:+-R \"$repo\"} -F -" } } } }}The tool's own --params are shared by every action. A plugin is trusted code already, so skipping a prompt grants it nothing new; to overrule a plugin, re-declare the action in your config with --skip-permission false.
How calls look in the chat
By default a call shows the tool's name and its raw JSON input. --title and --summary replace that with a name and a one-line description built from the call's parameters, using Go text/template syntax. Every declared parameter is available as .name, as an empty string when the call left it out. Two helpers are available on top of the template builtins:
plural COUNT DEFAULT WORDrenders "1 pull request" or "5 pull requests", usingDEFAULTwhen the count is empty or not a number.truncate N TEXTshortens text to one line of at mostNcharacters, for previews like a comment body.
tool action GitHub pr_list --description "List pull requests" \ --param limit "How many to show" \ --title 'List PRs' \ --summary 'Latest {{plural .limit 20 "pull request"}}{{with .repo}} in {{.}}{{end}}' \ --command 'gh pr list --limit "${limit:-20}" ${repo:+-R "$repo"}'{ "custom_tools": { "GitHub": { "actions": { "pr_list": { "description": "List pull requests", "params": { "limit": "How many to show" }, "title": "List PRs", "summary": "Latest {{plural .limit 20 \"pull request\"}}{{with .repo}} in {{.}}{{end}}", "command": "gh pr list --limit \"${limit:-20}\" ${repo:+-R \"$repo\"}" } } } }}A call to {"action":"pr_list","limit":"1","repo":"charmbracelet/crush"} then shows as List PRs · Latest 1 pull request in charmbracelet/crush. While the input is still streaming, or when nothing is declared, the call renders the default way.
tool remove
Remove a tool declared earlier in the same file. To turn off a tool another file declares, use tool add <name> --disabled true or permissions deny.
Usage: tool remove <name> tool rm <name>