Chapter 14

Built-In Tools Deep Dive: Capabilities and Use Cases of All 16 Core Tools

Chapter 14: Complete Built-in Tool Guide โ€” Capability Boundaries and Use Cases for 16 Core Tools

Overview

OpenClaw includes 16 native built-in tools, covering all core capabilities: file operations, command execution, browser control, web search, scheduled task management, memory management, and multi-Agent coordination. Understanding each tool's boundaries and applicable scenarios is a prerequisite for building efficient Agent workflows.


14.1 Tool Overview

Tool Name Category Core Capability
read File Operations Read file contents
write File Operations Create or overwrite files
edit File Operations Precisely modify file contents
exec Command Execution Execute shell commands (with sandbox)
bash Command Execution Execute Bash script blocks
process Process Management Start/stop/monitor processes
browser Browser Control Automate web interactions
web_search Web Search Integrated search engine queries
message Messaging Send messages to users/systems
cron Scheduled Tasks Create and manage scheduled jobs
memory_search Memory Management Semantic search in memory store
memory_get Memory Management Read specific memory files
sessions_spawn Agent Coordination Spawn sub-Agents
canvas_* Visual Workspace Canvas control operations group
node_* Physical Devices IoT/hardware node control group

14.2 read โ€” File Reading

Description

Reads the contents of a file from the local filesystem. Supports both text and binary files.

Interface Definition

{
  "tool": "read",
  "input": {
    "path": "/path/to/file",
    "encoding": "utf-8",
    "start_line": 1,
    "end_line": 100,
    "max_bytes": 102400
  }
}

Parameter Reference

Parameter Type Required Description
path string Yes Absolute file path
encoding string No Default utf-8, also supports base64
start_line int No Start line number (inclusive)
end_line int No End line number (inclusive)
max_bytes int No Maximum bytes to read

Applicable Scenarios

Limitations


14.3 write โ€” File Writing

Description

Creates a new file or overwrites the entire contents of an existing file.

Interface Definition

{
  "tool": "write",
  "input": {
    "path": "/path/to/output.txt",
    "content": "File content goes here",
    "encoding": "utf-8",
    "create_dirs": true,
    "overwrite": true
  }
}

Applicable Scenarios

Limitations


14.4 edit โ€” Precise File Editing

Description

Performs precise partial content modifications on files. Supports string replacement, line-number replacement, and regular expression replacement.

Interface Definition

{
  "tool": "edit",
  "input": {
    "path": "/path/to/file.py",
    "operations": [
      {
        "type": "replace_string",
        "old": "def old_function():",
        "new": "def new_function():",
        "replace_all": false
      },
      {
        "type": "replace_lines",
        "start_line": 42,
        "end_line": 45,
        "new_content": "# New code block\nprint('hello')"
      },
      {
        "type": "insert_after_line",
        "line": 10,
        "content": "# Inserted comment"
      }
    ]
  }
}

Decision Logic: read vs edit vs write

Need to read file contents?
    --> Use read

Need to modify a file?
    --> Need to modify the entire file?
        --> Use write
    --> Only need to modify specific parts?
        --> Use edit
            --> Know the exact string? Use replace_string
            --> Know the line number range? Use replace_lines

14.5 exec โ€” Shell Command Execution

Description

Executes a single shell command with sandbox control and timeout management.

Interface Definition

{
  "tool": "exec",
  "input": {
    "command": "ls -la /workspace",
    "cwd": "/workspace",
    "env": {
      "MY_VAR": "value"
    },
    "timeout_seconds": 30,
    "capture_output": true
  }
}

Output Format

{
  "stdout": "file listing content...",
  "stderr": "",
  "exit_code": 0,
  "duration_ms": 142
}

14.6 bash โ€” Bash Script Block Execution

Description

Executes multi-line Bash scripts with support for pipes, variables, and complex logic.

Interface Definition

{
  "tool": "bash",
  "input": {
    "script": "#!/bin/bash\nset -e\ncd /workspace\nfor f in *.py; do\n  echo \"Processing: $f\"\n  python -m py_compile \"$f\"\ndone",
    "timeout_seconds": 60,
    "cwd": "/workspace"
  }
}

Differences: exec vs bash

Dimension exec bash
Best for Single commands Multi-step scripts
Pipe support Limited Complete
Variable assignment Not persistent Persistent across lines
Error handling Basic Complete (set -e/-o pipefail)
Debuggability Simple Supports set -x
Dangerous env vars Stripped before execution Stripped before execution

Important: Both tools strip dangerous environment variables before execution, including DYLD_*, LD_*, NODE_OPTIONS, etc.


14.7 process โ€” Process Management

Description

Starts, stops, and queries background processes. Suitable for services that need to run long-term.

Interface Definition

{
  "tool": "process",
  "input": {
    "action": "start",
    "command": "python server.py",
    "cwd": "/workspace",
    "name": "my-server",
    "restart_on_crash": true,
    "log_file": "/var/log/my-server.log"
  }
}

Action Types

action Description
start Start a new process
stop Stop the specified process
restart Restart a process
status Query process status
list List all managed processes
log Read process logs

Applicable Scenarios


14.8 browser โ€” Browser Control

Description

Controls a headless browser via Playwright/Puppeteer for web automation.

Coordinate Click

{
  "tool": "browser",
  "input": {
    "action": "click",
    "selector": "#submit-button",
    "x": 450,
    "y": 320,
    "click_type": "left"
  }
}

Form Filling

{
  "tool": "browser",
  "input": {
    "action": "fill_form",
    "fields": [
      {"selector": "#username", "value": "admin"},
      {"selector": "#password", "value": "${SECRET_PASSWORD}"},
      {"selector": "#remember-me", "action": "check"}
    ]
  }
}
{
  "tool": "browser",
  "input": {
    "action": "navigate",
    "url": "https://example.com"
  }
}

Complete Action Set

action Description
navigate Open URL
click Click an element
fill Fill an input field
fill_form Batch fill a form
screenshot Take a screenshot
scroll Scroll the page
wait_for Wait for element to appear
evaluate Execute JavaScript
get_text Get element text
get_html Get page HTML
select Select a dropdown option
hover Hover over an element

Applicable Scenarios


Description

Integrates multiple search engines and content scraping services to retrieve real-time web information.

Supported Backends

Backend Characteristics Configuration
Exa Semantic search, high-quality results EXAI_API_KEY
Tavily AI-optimized search with summaries TAVILY_API_KEY
Firecrawl Complete page content scraping FIRECRAWL_API_KEY
Serper Google results, high speed SERPER_API_KEY
Bing Microsoft Bing search BING_SEARCH_KEY

Interface Definition

{
  "tool": "web_search",
  "input": {
    "query": "OpenClaw Agent framework 2026",
    "backend": "tavily",
    "max_results": 5,
    "include_content": true,
    "time_range": "month"
  }
}

Sample Output

{
  "results": [
    {
      "title": "OpenClaw v3.0 Release Notes",
      "url": "https://docs.openclaw.dev/changelog",
      "snippet": "OpenClaw 3.0 introduces...",
      "content": "Full page content...",
      "published_date": "2026-03-15"
    }
  ],
  "total_results": 5
}

14.10 message โ€” Message Sending

Description

Sends messages to users, system logs, or external webhooks. Supports multiple message types.

Interface Definition

{
  "tool": "message",
  "input": {
    "target": "user",
    "content": "Task completed โ€” please review the results",
    "type": "info",
    "attachments": [
      {"type": "file", "path": "/output/report.pdf"}
    ]
  }
}

Message Targets

target Description
user Send to the current user
log Write to system log
webhook Send to configured webhook
slack Send to a Slack channel
email Send email

Message Types

type Description
info General information
warning Warning message
error Error notification
success Success notification
progress Progress update

14.11 cron โ€” Scheduled Task Management

Description

Creates, manages, and deletes scheduled tasks. Supports standard Cron expressions.

Cron Expression Syntax

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Minute (0-59)
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Hour (0-23)
โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Day of month (1-31)
โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Month (1-12)
โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Day of week (0-6, 0=Sunday)
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚
* * * * *

Interface Definition

{
  "tool": "cron",
  "input": {
    "action": "create",
    "name": "daily-report",
    "schedule": "0 9 * * 1-5",
    "task": {
      "type": "agent_run",
      "agent": "report-generator",
      "input": {"date": "${today}"}
    },
    "timezone": "America/New_York",
    "enabled": true
  }
}

Common Cron Expression Examples

# Every day at 9 AM on weekdays
0 9 * * 1-5

# Every hour
0 * * * *

# Every 15 minutes
*/15 * * * *

# First day of every month at midnight
0 0 1 * *

# Every Sunday at 2 AM for backups
0 2 * * 0

# Every day at 3 PM and 6 PM
0 15,18 * * *

Cron Action Types

action Description
create Create a new scheduled task
update Modify an existing task
delete Delete a task
enable Enable a task
disable Disable a task
list List all tasks
run_now Execute once immediately

Description

Performs semantic similarity searches in the Agent memory store, returning the most relevant memory fragments.

Interface Definition

{
  "tool": "memory_search",
  "input": {
    "query": "user preferred output format settings",
    "top_k": 5,
    "threshold": 0.7,
    "namespace": "user_preferences",
    "filters": {
      "created_after": "2026-01-01",
      "tags": ["preferences", "format"]
    }
  }
}

Sample Output

{
  "memories": [
    {
      "id": "mem_abc123",
      "content": "User prefers JSON output format with 2-space indentation",
      "similarity": 0.92,
      "created_at": "2026-02-15T10:23:00Z",
      "tags": ["preferences", "format"]
    }
  ]
}

14.13 memory_get โ€” Reading Specific Memory Files

Description

Precisely reads a specific memory entry by ID or path, without performing semantic search.

Interface Definition

{
  "tool": "memory_get",
  "input": {
    "id": "mem_abc123",
    "path": "user_preferences/output_format.md",
    "namespace": "global"
  }
}

Decision Logic: memory_search vs memory_get

Do you know what memory you need?
    |
    +-- Know the exact ID or filename --> Use memory_get (precise, fast)
    |
    +-- Know roughly what it's about but not its location --> Use memory_search (semantic search)
    |
    +-- Need to batch-scan related memories --> First memory_search, then memory_get on results

14.14 sessions_spawn โ€” Spawning Sub-Agents

Description

Creates independent sub-Agent sessions for parallel task processing or specialized task division.

Interface Definition

{
  "tool": "sessions_spawn",
  "input": {
    "agent_config": {
      "name": "code-reviewer",
      "model": "anthropic/claude-opus-4-6",
      "system_prompt": "You are a professional code review Agent focused on security vulnerability detection",
      "tools": ["read", "web_search"],
      "max_turns": 20
    },
    "initial_message": "Please review all Python files in the /workspace/src directory",
    "delivery_mode": "background",
    "on_complete_notify": true
  }
}

Delivery Modes

Mode Description Best For
interactive Real-time streaming of results When you need to monitor sub-Agent progress in real time
background Results announced upon completion Long-running tasks; main Agent continues other work

Usage Patterns

Pattern A: Parallel Task Decomposition

// Main Agent spawns multiple sub-Agents for different modules simultaneously
{
  "tool": "sessions_spawn",
  "input": {
    "agent_config": {"name": "frontend-agent"},
    "initial_message": "Optimize React component performance"
  }
}
// Simultaneously
{
  "tool": "sessions_spawn",
  "input": {
    "agent_config": {"name": "backend-agent"},
    "initial_message": "Optimize API endpoint performance"
  }
}

Pattern B: Specialized Division of Labor

{
  "tool": "sessions_spawn",
  "input": {
    "agent_config": {
      "name": "security-auditor",
      "system_prompt": "Focus on security auditing, use only the read tool",
      "tools": ["read"],
      "tool_policy": "allowlist"
    }
  }
}

14.15 Canvas Control Tool Group

Canvas tools operate on OpenClaw's visual workspace, supporting the creation of interactive dashboards and workflow visualizations.

Main Operations

{
  "tool": "canvas_create_node",
  "input": {
    "type": "text",
    "content": "Data analysis results",
    "x": 100,
    "y": 200,
    "width": 300,
    "height": 150
  }
}
Tool Name Description
canvas_create_node Create a Canvas node
canvas_update_node Update node content
canvas_delete_node Delete a node
canvas_connect Connect two nodes
canvas_layout Auto-layout

14.16 Node Device Control Tool Group

Node tools control physical devices and IoT nodes. Suitable for edge computing and industrial automation scenarios.

{
  "tool": "node_send_command",
  "input": {
    "node_id": "sensor-hub-01",
    "command": "read_temperature",
    "params": {"unit": "celsius"}
  }
}

14.17 Combined Tool Usage Patterns

Pattern A: Code Generation and Validation

web_search (look up documentation)
    --> read (read existing code)
    --> write/edit (generate new code)
    --> exec (run tests)
    --> message (report results)

Pattern B: Scheduled Data Collection

cron (trigger schedule)
    --> web_search (search for latest data)
    --> write (save raw data)
    --> sessions_spawn (async analysis Agent)
    --> message (send analysis report)

Pattern C: Automated Web Operations

browser (navigate to target page)
    --> browser (fill out form)
    --> browser (screenshot to confirm)
    --> write (save screenshot)
    --> message (notify completion)

Chapter Summary

Next chapter will dive deep into tool policy: Allow/Deny rules, sandbox configuration, and the elevated flag.

Rate this chapter
4.6  / 5  (23 ratings)

๐Ÿ’ฌ Comments