Skip to content

Built-in Tools

ra ships with built-in tools that give the agent the ability to interact with the filesystem, run shell commands, make HTTP requests, spawn parallel sub-agents, and communicate with the user. When memory is enabled, additional memory tools are registered. All tools are registered automatically when builtinTools is enabled (the default).

Tools are self-describing — each includes a detailed schema and description so the model knows when and how to use them. You can further guide tool usage through system prompts or middleware.

yaml
# ra.config.yml
builtinTools: true   # default

When ra runs as an MCP server, all built-in tools (except AskUserQuestion) are automatically exposed as MCP tools.

Filesystem

Read

Read the contents of a file. Returns content with line numbers prefixed (e.g. 1: first line).

ParameterTypeRequiredDescription
pathstringyesAbsolute or relative path to the file
offsetnumbernoStart reading from this line number (1-based)
limitnumbernoMaximum number of lines to return
json
{ "path": "src/index.ts", "offset": 10, "limit": 20 }

Write

Create or overwrite a file. Parent directories are created automatically.

ParameterTypeRequiredDescription
pathstringyesPath to the file to write
contentstringyesContent to write
json
{ "path": "src/hello.ts", "content": "export const hello = 'world'" }

Edit

Replace the first occurrence of a string in a file. The match must be exact, including whitespace and indentation.

ParameterTypeRequiredDescription
pathstringyesPath to the file to update
old_stringstringyesExact string to find
new_stringstringyesReplacement string
json
{
  "path": "src/config.ts",
  "old_string": "const PORT = 3000",
  "new_string": "const PORT = 8080"
}

AppendFile

Append content to the end of a file. Creates the file and parent directories if they don't exist. Does not add any separator — include a newline in the content if needed.

ParameterTypeRequiredDescription
pathstringyesPath to the file
contentstringyesContent to append

LS

List files and directories at a path. Directories have a trailing /. Does not recurse into subdirectories.

ParameterTypeRequiredDescription
pathstringyesDirectory to list

Grep

Search for a text pattern across files recursively. Returns matches in path:line:content format. Skips node_modules and .git.

ParameterTypeRequiredDescription
pathstringyesDirectory to search in
patternstringyesText to search for (plain string, not regex)
includestringnoFilename glob filter, e.g. "*.ts"
json
{ "path": "src", "pattern": "TODO", "include": "*.ts" }

Glob

Find files matching a glob pattern. Supports *, **, and ?.

ParameterTypeRequiredDescription
pathstringyesDirectory to search in
patternstringyesGlob pattern, e.g. "**/*.test.ts"

MoveFile

Move or rename a file or directory. Creates parent directories at the destination.

ParameterTypeRequiredDescription
sourcestringyesCurrent path
destinationstringyesNew path

CopyFile

Copy a file or directory. Directories are copied recursively. Creates parent directories at the destination.

ParameterTypeRequiredDescription
sourcestringyesPath to copy from
destinationstringyesPath to copy to

DeleteFile

Delete a file or directory. Directories are deleted recursively. Irreversible.

ParameterTypeRequiredDescription
pathstringyesPath to delete

Shell

ra registers a platform-specific shell tool based on the OS it's running on. Only one is available at a time.

Bash macOS / Linux

Execute a bash command and return combined stdout/stderr output. The description includes the detected OS (macOS or Linux).

ParameterTypeRequiredDescription
commandstringyesBash command to execute
cwdstringnoWorking directory
timeoutnumbernoTimeout in milliseconds (default: 30000)
json
{ "command": "git status", "cwd": "/home/user/project" }

PowerShell Windows

Execute a PowerShell command and return the output. Runs with -NoProfile for fast startup.

ParameterTypeRequiredDescription
commandstringyesPowerShell command to execute
cwdstringnoWorking directory
timeoutnumbernoTimeout in milliseconds (default: 30000)
json
{ "command": "Get-ChildItem -Recurse -Filter *.ts" }

Network

WebFetch

Make an HTTP request and return the response as JSON with status, headers, and body fields.

ParameterTypeRequiredDescription
urlstringyesURL to fetch
methodstringnoHTTP method (default: GET)
headersobjectnoRequest headers as key-value pairs
bodystringnoRequest body
json
{
  "url": "https://api.example.com/data",
  "method": "POST",
  "headers": { "Authorization": "Bearer token" },
  "body": "{\"key\": \"value\"}"
}

Agent Interaction

AskUserQuestion

Pause the agent loop and ask the user a question. The loop suspends until the user responds.

  • REPL — the question is printed and the next input resumes the conversation
  • CLI — the session ID is printed so the user can resume with --resume
  • HTTP — an AskUserQuestion SSE event is emitted with the question and session ID
ParameterTypeRequiredDescription
questionstringyesQuestion to ask the user

This tool is not exposed via MCP since MCP clients manage their own user interaction.

TodoWrite

Track tasks with a checklist. The tool description dynamically updates to show remaining items and their indices, keeping the model aware of progress without needing to call list.

Actions:

ActionParametersDescription
additem (string)Add an item to the checklist
checkindex (number)Mark an item as done (0-based)
uncheckindex (number)Mark an item as not done
removeindex (number)Remove an item
listShow all items with status
json
{ "action": "add", "item": "Write tests" }
{ "action": "check", "index": 0 }
{ "action": "list" }

The dynamic description looks like:

Track tasks with a checklist. Actions: "add" (item text), "check"/"uncheck"/"remove" (by 0-based index), "list" (show all). Remaining (2/3): 1: Fix bug, 2: Deploy

Parallelization

Agent

Fork parallel copies of the agent to work on independent tasks simultaneously. Each fork inherits the parent's model, system prompt, tools, and thinking level — it's the same agent with a fresh conversation.

ParameterTypeRequiredDescription
tasksarrayyesTasks to run in parallel
tasks[].taskstringyesThe task prompt for the fork
json
{
  "tasks": [
    { "task": "Read src/auth.ts and summarize the authentication flow" },
    { "task": "Find all TODO comments in the codebase" },
    { "task": "Check for unused exports in src/utils/" }
  ]
}

Returns { results, usage } where each result has task, status, result, iterations, and usage. Aggregate usage rolls up into the parent's token tracking automatically.

Only AskUserQuestion and Agent are excluded from forks — AskUserQuestion can't work from a background fork, and Agent nesting is depth-limited (default: 2) to prevent infinite recursion. All other tools (including memory) are inherited. Task failures don't affect siblings.

Forks honor the parent's maxIterations. Use maxConcurrency (default: 4) to control how many forks run in parallel.

MCP

When MCP clients are configured, all MCP tools are registered with server-prefixed names (github__search) to avoid conflicts. When mcp.lazySchemas is enabled (the default), schemas are additionally stripped — on the first call to each tool, ra returns the full schema as an error, and the model retries with correct parameters. See MCP for details.

Memory

When memory is enabled, three additional tools are registered.

memory_save

Save a fact to persistent memory for future conversations. Proactively saves user preferences, project decisions, corrections, and key context. To update an existing memory, the agent forgets the old version first, then saves the new one.

ParameterTypeRequiredDescription
contentstringyesSelf-contained fact, e.g. "User prefers tabs over spaces"
tagsstringnoCategory: preference, project, convention, team, or tooling

Search persistent memories by keyword. Recent memories are automatically injected at conversation start — this tool is for targeted lookups beyond the recalled set.

ParameterTypeRequiredDescription
querystringyesFull-text search keywords, e.g. "typescript tabs" or "deployment"
limitnumbernoMax results (default: 10)

memory_forget

Delete memories matching a search query. Used when the user corrects previous information, a fact becomes outdated, or before saving an updated version of an existing memory.

ParameterTypeRequiredDescription
querystringyesSearch keywords to match memories to delete
limitnumbernoMax memories to delete (default: 10)

Disabling built-in tools

To run ra without built-in tools (e.g., when using only MCP tools):

yaml
builtinTools: false
bash
ra --no-builtin-tools

See also

  • The Agent Loop — how tools are executed within the loop
  • MiddlewarebeforeToolExecution and afterToolExecution hooks
  • MCP — connecting external MCP tools

Released under the MIT License.