Tools allow the LLM to perform actions in your codebase. OpenCode comes with a set of built-in tools, but you can extend it with [custom tools](/docs/custom-tools) or [MCP servers](/docs/mcp-servers).
By default, all tools are **enabled** and don't need permission to run. But you can configure this and control the [permissions](/docs/permissions) through your config.
---
## Configure
You can configure tools globally or per agent. Agent-specific configs override global settings.
By default, all tools are set to `true`. To disable a tool, set it to `false`.
---
### Global
Disable or enable tools globally using the `tools` option.
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"tools": {
"write": false,
"bash": false,
"webfetch": true
}
}
```
You can also use wildcards to control multiple tools at once. For example, to disable all tools from an MCP server:
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"tools": {
"mymcp_*": false
}
}
```
---
### Per agent
Override global tool settings for specific agents using the `tools` config in the agent definition.
```json title="opencode.json" {3-6,9-12}
{
"$schema": "https://opencode.ai/config.json",
"tools": {
"write": true,
"bash": true
},
"agent": {
"plan": {
"tools": {
"write": false,
"bash": false
}
}
}
}
```
For example, here the `plan` agent overrides the global config to disable `write` and `bash` tools.
You can also configure tools for agents in Markdown.
Allows the LLM to fetch and read web pages. Useful for looking up documentation or researching online resources.
---
## Custom tools
Custom tools let you define your own functions that the LLM can call. These are defined in your config file and can execute arbitrary code.
[Learn more](/docs/custom-tools) about creating custom tools.
---
## MCP servers
MCP (Model Context Protocol) servers allow you to integrate external tools and services. This includes database access, API integrations, and third-party services.
[Learn more](/docs/mcp-servers) about configuring MCP servers.
---
## Internals
Internally, tools like `grep`, `glob`, and `list` use [ripgrep](https://github.com/BurntSushi/ripgrep) under the hood. By default, ripgrep respects `.gitignore` patterns, which means files and directories listed in your `.gitignore` will be excluded from searches and listings.
To include files that would normally be ignored, create a `.ignore` file in your project root. This file can explicitly allow certain paths.
```text title=".ignore"
!node_modules/
!dist/
!build/
```
For example, this `.ignore` file allows ripgrep to search within `node_modules/`, `dist/`, and `build/` directories even if they're listed in `.gitignore`.