文档
English Docs
Tools

Tools

Tools enable LLMs to perform actions within your codebase. OpenCode provides built-in tools with the ability to extend through custom tools and MCP servers.

Configuration

Tools are managed through the permission field in opencode.json:

  • "allow" - Execute without approval
  • "deny" - Prevent execution
  • "ask" - Require user approval
{
  "permission": {
    "edit": "ask",
    "bash": "ask"
  }
}

Wildcard patterns supported: "mcp_*" for multiple tools.

Built-in Tools

File Operations

ToolPurpose
readRetrieve file contents
writeCreate or overwrite files
editPrecise string replacements
patchApply diffs and patches

Search & Discovery

ToolPurpose
grepSearch with regular expressions
globFind files by pattern
listEnumerate directory contents

Execution & Integration

ToolPurpose
bashExecute shell commands
lspCode intelligence (experimental)

Specialized Tools

ToolPurpose
skillLoad SKILL.md content
webfetchFetch web pages
questionAsk user questions
todowrite/todoreadManage task lists

File Ignoring

By default, search tools respect .gitignore. Create a .ignore file to allow searching otherwise-ignored directories.