Skip to content

Agent Tools

Agent tools let AI coding agents interact with your development environment: reading files, running commands, searching code, and connecting to external services.

Tool categories:

  • Built-in tools: Read, Write, Edit, Bash, Grep, Glob
  • Shell tools through bash (git, npm, docker, curl)
  • MCP tools for external services requiring structure or authentication

Built-in Tools Comparison

Both Claude Code and Opencode provide similar core tools for file operations and shell access:

Capability Claude Code Opencode Description
Read files Read read View file contents
Write files Write write Create or overwrite files
Edit files Edit edit Modify existing files
Shell commands Bash bash Execute terminal commands
Pattern search Grep grep Search with regex
File discovery Glob glob Find files by pattern

Additional Opencode Tools

Opencode provides extra built-in tools:

  • list - directory contents
  • lsp - language server integration (hover, go-to-definition)
  • patch - edit multiple locations at once
  • skill - run registered skills
  • todoread / todowrite - task tracking
  • webfetch - fetch URLs
  • question - prompt the user

Bash-First Philosophy

From Anthropic's best practices: the agent has access to your shell environment. You can build convenience scripts and functions for it like you would for yourself.

Bash is the primary tool layer. The agent inherits your shell environment with all your functions and aliases.

For reusable workflows, create skills that agents can invoke via slash commands. Prefer standard CLI tools (gh, git, npm) over MCP equivalents.

When to Use Which Tool

Task Recommended Tool Rationale
Run commands Bash Direct shell access
Git operations Bash Full git CLI available
Install packages Bash npm/pip/etc. work natively
Create files Write Transactional safety, prevents partial failures
Modify files Edit Atomic changes with precise targeting
Complex search Grep + Glob Purpose-built for pattern matching
External APIs MCP Only when auth/state needed

Custom Bash Tools

You can create shell functions that agents will discover and use:

# In ~/.bashrc or project .envrc
function project-test() {
    npm run test -- --coverage
}

function project-lint() {
    npm run lint -- --fix
}

For complex workflows, wrap these in skills so agents can invoke them via /project-test or /project-lint.

Tool Selection Guide

Task Type First Choice Fallback
Run tests Bash
Format code Bash
Search codebase Grep / Glob Bash with rg/fd
Read file Read Bash with cat
Edit file Edit Write (full replacement)
Create file Write Bash with cat/echo
Git commit Bash
API calls (no auth) Bash with curl MCP
Database queries MCP Bash with psql/mysql
JIRA/Linear tickets MCP

Best Practices

Start with Bash. Move to built-in tools when you need better error handling, and MCP only when you need the constraints it provides.

Keep MCP servers to a minimum since each one consumes context tokens. Wrap reusable workflows in skills. Give subagents only the tools they need.

Runtime Support

Runtime Built-in Tools MCP Support Documentation
Claude Code tools
Opencode tools
Cursor tools
Cline tools
Copilot Limited

Learn More