Tools
A tool is an action the model can call, such as reading a file or running a shell command. Each agent selects its tools in tools.use, in the order you list them. Raw loads only the tools an agent selects, and the model sees only those tools.
Built-in tools
Section titled “Built-in tools”Raw ships fourteen tools. Select them with the builtin/ prefix.
| Tool ID | What it does | Selection |
|---|---|---|
builtin/read_file |
Reads one window of one UTF-8 text file, by line. | Starter agent |
builtin/write_file |
Creates a file or replaces its whole content. | Starter agent |
builtin/edit_file |
Replaces exact text in an existing file. | Starter agent |
builtin/apply_patch |
Adds, updates, moves or deletes several files with one patch. | Explicit, opt-in |
builtin/bash |
Runs one Bash command and returns its output and exit status. | Starter agent |
builtin/powershell |
Runs one PowerShell command, with the same arguments and result as bash. |
Explicit; starter agent on Windows without Git Bash |
builtin/list_skills |
Lists the skills the agent selected, with their descriptions. | Starter agent |
builtin/load_skill |
Loads the Markdown body of one selected skill. | Starter agent |
builtin/view_image |
Reads a local PNG or JPEG for the model. Requires vision: true on the model. |
Explicit |
builtin/list_vars |
Lists the runtime variables the agent selected, without reading their values. | Starter agent |
builtin/read_var |
Reads one selected runtime variable. | Starter agent |
builtin/todo |
Keeps a task list in a live side panel. | Explicit |
builtin/ask_user |
Asks the user one question, or up to three questions in one form. | Explicit |
builtin/process |
Starts and manages background processes across turns. | Explicit |
The starter agent created by raw config init selects the eight tools marked “Starter agent”. Tools marked “Explicit” are off until an agent lists them. apply_patch is opt-in: add it for models trained on the patch format, and select edit_file for exact replacements.
Select tools for an agent
Section titled “Select tools for an agent”tools.use is required in every agent. It accepts these ID forms:
| Prefix | Where Raw loads it from |
|---|---|
builtin/<name> |
The installed Raw package. |
local/<folder> |
$XDG_CONFIG_HOME/raw/tools/<folder>/, or ~/.config/raw/tools/<folder>/. |
agent/<folder> |
tools/<folder>/ beside the selected config file. |
mcp/<server>/<tool> |
A tool from a server in mcp.servers. See MCP. |
pkg/<alias>/tools/<export> |
A tool from an installed package. See Packages. |
An empty array gives the agent no tools.
{ "agents": { "coder": { "model": "local", "tools": { "use": [ "builtin/read_file", "builtin/write_file", "builtin/bash", "local/my_bash" ] } } }}Model-visible tool names must be unique among the selected tools. Two tools cannot share a name, and the same folder cannot be selected twice.
Control tools with rules
Section titled “Control tools with rules”tools.rules sets a policy for tools in tools.use. Each rule has a match glob and an effect.
| Field | Values |
|---|---|
match |
A glob over the full tool identity, such as builtin/bash or mcp/search/*. * matches any run of characters and ? matches one character. |
effect |
allow, ask, or deny. |
when |
Optional. Only valid with ask. Inspects selected arguments: string, number, or boolean fields. |
Rules apply in order, and the last matching rule wins. A call with no matching rule runs automatically.
allowruns the call without a prompt.askasks for permission each time the call is made.denyremoves the tool’s schema from the model and rejects direct calls.
The following rule asks before any Bash command that runs rm. Other Bash calls run without a prompt.
{ "match": "builtin/bash", "effect": "ask", "when": { "source": "arguments", "any": "command", "regex": "(^|[;&|()\\n])\\s*(sudo\\s+)?(/usr/bin/|/bin/)?rm(\\s|$)" }}Fork a shipped tool
Section titled “Fork a shipped tool”Every built-in tool has an editable copy in the package at examples/tools/<name>/. To change one, copy it into your config directory and select it as a local/ tool.
-
Copy the folder to a new ID under your Raw config directory.
Terminal window mkdir -p ~/.config/raw/toolscp -R examples/tools/bash ~/.config/raw/tools/my_bash -
Edit
tool.jsonin the copy. Setidto match the folder name,my_bash. Changenameif the model-facing name should differ. -
Edit
index.mjsas needed. The.mjsfile runs directly, so you do not need to rebuild Raw. -
Select the fork in the agent’s
tools.uselist."tools": { "use": ["builtin/read_file", "local/my_bash"] }
Write a local tool
Section titled “Write a local tool”A local tool is a folder with two files: tool.json and an entry module named by entry.
Directory~/.config/raw/tools/
Directoryproject_note/
- tool.json
- index.mjs
This manifest is from the project helper example.
{ "api_version": 2, "id": "project_note", "version": "1.0.0", "name": "project_note", "description": "Return a short note about the current project directory.", "input_schema": { "type": "object", "properties": {}, "required": [], "additionalProperties": false }, "entry": "./index.mjs", "condition_sources": ["arguments"]}export async function handler(_args, context) { return { content: [{ type: "text", text: `Project directory: ${context.cwd}` }] };}Manifest fields
Section titled “Manifest fields”| Field | Required | Rules |
|---|---|---|
api_version |
Yes | Must be 2. |
id |
Yes | Folder name. Lowercase letters, digits, _ and -, starting with a letter. |
version |
Yes | major.minor.patch. |
name |
Yes | Model-facing name. Starts with a letter or _, up to 64 letters, digits, _ or -. |
description |
Yes | Tells the model what the tool does and what its result means. |
input_schema |
Yes | A JSON Schema object (draft-07 or 2020-12). Local $ref only. |
entry |
Yes | Must be ./index.mjs. |
condition_sources |
No | Argument sources that rules may inspect. Use ["arguments"] for argument-based rules. |
display |
No | How the terminal and dashboard show the tool. See Display hints. |
effects_schema |
No | Schema for effects a tool declares before it runs. Advanced; see Tool contract. |
panels |
No | Up to four live side panels the tool owns. See Tool contract. |
Manifests reject unknown fields. Symlinked folders, manifests, or entries that point outside the tool’s root fail before any code is imported.
Display hints
Section titled “Display hints”display is optional. It sets the title, icon, summary, and result style that the terminal and dashboard show for each call. Every field is optional:
"display": { "title": "Fetch page", "kind": "search", "icon": "search", "summary": "{url}", "result": "markdown"}title: up to 80 characters. Without it, the tool name in sentence case is used, sofetch_pageshows asFetch page.kind:read,edit,execute,search,fetch,thinkorother(the default). It picks the default icon in the terminal and the kind reported over ACP.icon: a lowercase icon name. Surfaces use it when they have an icon with that name. Otherwise the kind decides.summary: a template of up to 200 characters over the call’s arguments.{name}is replaced by the argument’s value, and{name|text}usestextwhen the argument is missing. A[...]part appears only when every placeholder inside it has a value.result:text,markdown,code,json,terminalordiff. Without it, Raw picks a style from the result.
A summary is one line, cut at 120 characters. An argument whose name contains token, secret, password, or key shows as •••. Summaries of the file tools show paths and sizes, never file contents.
Entry module
Section titled “Entry module”The entry module exports:
handler(args, context), an async function that returns the result. Results are text, JSON, or image blocks.validateArgs(args), optional. Returns an error string for invalid arguments, orundefined.
Raw checks the JSON Schema and validateArgs before it asks for permission or runs anything. The context object provides:
cwd, the session’s working directory.signal, an abort signal that fires on cancellation.- The result size cap and the tool-call ID.
sessionId, the persisted session the call runs in. It isundefinedwhen the runtime has no session store, so a tool must cope with that. A tool can use it to keep per-session state.vars, the variable service. See Variables.
Single-call tools
Section titled “Single-call tools”The built-in file and shell tools take one operation per call:
read_filereads one window of one file:{"path":"src/app.ts","offset":120,"limit":80}.offsetis the first line to read (1-based, default 1) andlimitis the number of lines (default 2000). To read several files, make several calls.write_filecreates a file or replaces its whole content, creating parent directories:{"path":"notes/todo.md","content":"# Todo\n"}.edit_filereplaces exact text in an existing file:{"path":"src/app.ts","old_string":"const a = 1;","new_string":"const a = 2;"}.old_stringmust match exactly, including indentation, and occur once unlessreplace_allistrue.apply_patchapplies one patch that adds, updates, moves, or deletes several files. It is opt-in.bashruns one command:{"command":"npm test","timeout":300000}.timeoutis in milliseconds, with a default of 120000 and a maximum of 600000. For several commands, make several calls or join them with&&. Setrun_in_backgroundto start a server or watcher throughbuiltin/process, when that tool is selected.
The batch shapes from earlier versions are not supported. read_file rejects {"files":[…]}, and bash rejects {"commands":[…]}. Each rejection includes an example of one call. write_file rejects operations and patch, and points to edit_file and apply_patch.
Argument normalization
Section titled “Argument normalization”The built-in tools accept the argument names that other tools commonly use, and rename them before validation. For example:
- File tools read
file_path,filePath, andabsolute_pathaspath. edit_filereadsold_strasold_stringandnew_strasnew_string.bashreadscmdascommandandtimeout_msastimeout.todoreads the statuscompletedasdone.
Each rename is recorded as a note on the result. Unknown top-level arguments are dropped, with a note, only when the tool’s schema sets additionalProperties: false.
Normalization applies only to the built-in tools. A local copy, a package tool, or an MCP tool receives exactly what the model sent. Permission rules, hooks, approval, and the display see the normalized arguments. The saved history keeps the call as the model sent it.
Output budget
Section titled “Output budget”Each tool result is capped at max_output_bytes for the model. The default is 65536 bytes (64 KiB). Set it with the --max-output-bytes flag, the RAW_MAX_OUTPUT_BYTES variable, or the max_output_bytes field of an agent. See the CLI reference and the Configuration reference.
When a result is longer than the cap, the model gets a shortened version and a note with the path of a saved copy of the complete output. The saved copy holds up to 64 MiB, and the model can read it with read_file. JSON results stay valid JSON when shortened. Bash is the exception: it keeps the start and the end of its output, where errors and summaries usually are, with a marker between them that gives the number of omitted bytes and the path of the saved copy.
The cap limits what the model receives. The terminal shows its own bounded preview.