Built-in Tools

OpenClaw comes with powerful built-in tools that enable your AI assistant to interact with your system, browse the web, manage files, and more.

Tool Overview

Tool Description Use Case
exec Execute shell commands Run scripts, git, npm, etc.
read Read file contents View code, configs, logs
write Create or overwrite files Save code, create configs
edit Make precise file edits Modify existing code
browser Control web browser Automation, scraping
web_search Search the web Find information online
web_fetch Fetch webpage content Read articles, docs

exec - Shell Commands

Execute shell commands on the host system. Supports background processes and PTY mode.

Parameters

  • command (required) - The shell command to execute
  • workdir - Working directory
  • timeout - Timeout in seconds
  • background - Run in background
  • pty - Use pseudo-terminal

Examples

# Simple command
exec: ls -la

# With working directory
exec: npm install
workdir: /home/user/project

# Background process
exec: npm run dev
background: true

# With timeout
exec: long-running-script.sh
timeout: 300

read - Read Files

Read contents of text files and images. Supports pagination for large files.

Parameters

  • path (required) - Path to file
  • offset - Line number to start from
  • limit - Maximum lines to read

Examples

# Read entire file
read: /path/to/file.txt

# Read specific lines
read: /path/to/large-file.log
offset: 100
limit: 50

write - Create Files

Create new files or overwrite existing ones. Automatically creates parent directories.

Parameters

  • path (required) - Path for the file
  • content (required) - File content

Example

write:
  path: /home/user/hello.txt
  content: |
    Hello, World!
    This is a multi-line file.

edit - Precise Edits

Make surgical edits to files by replacing exact text matches.

Parameters

  • path (required) - Path to file
  • old_string (required) - Text to find
  • new_string (required) - Replacement text

Example

edit:
  path: /home/user/config.js
  old_string: "debug: false"
  new_string: "debug: true"

browser - Web Automation

Control a web browser for automation, testing, and scraping tasks.

Actions

  • open - Open a URL
  • snapshot - Capture page structure
  • screenshot - Take screenshot
  • act - Perform actions (click, type)
  • navigate - Navigate to URL

Example

browser:
  action: open
  targetUrl: https://example.com

browser:
  action: act
  request:
    kind: click
    ref: "button#submit"

web_search - Search the Web

Search the web using Brave Search API.

Parameters

  • query (required) - Search query
  • count - Number of results (1-10)
  • country - Country code (US, DE, etc.)

Example

web_search:
  query: "OpenClaw documentation"
  count: 5
  country: US

web_fetch - Fetch Webpages

Fetch and extract readable content from URLs.

Parameters

  • url (required) - URL to fetch
  • extractMode - "markdown" or "text"
  • maxChars - Maximum characters

Example

web_fetch:
  url: https://docs.example.com/guide
  extractMode: markdown
  maxChars: 10000

Tool Permissions

Control which tools are available in your configuration:

tools:
  exec:
    enabled: true
    allowlist:
      - git
      - npm
      - node
    denylist:
      - rm
      - sudo
  browser:
    enabled: true
  files:
    enabled: true
    workspace: ~/.openclaw/workspace

⚠️ Security Note

Be cautious with tool permissions. The exec tool can run arbitrary commands. Use allowlists to restrict available commands in production environments.