Skip to content

Commit e5d0c63

Browse files
committed
docs: simplify tools configuration by consolidating under permission field
1 parent 970796b commit e5d0c63

File tree

1 file changed

+70
-89
lines changed

1 file changed

+70
-89
lines changed

packages/web/src/content/docs/tools.mdx

Lines changed: 70 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -5,86 +5,37 @@ description: Manage the tools an LLM can use.
55

66
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).
77

8-
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.
8+
By default, all tools are **enabled** and don't need permission to run. You can control tool behavior through [permissions](/docs/permissions).
99

1010
---
1111

1212
## Configure
1313

14-
You can configure tools globally or per agent. Agent-specific configs override global settings.
15-
16-
By default, all tools are set to `true`. To disable a tool, set it to `false`.
17-
18-
---
19-
20-
### Global
21-
22-
Disable or enable tools globally using the `tools` option.
14+
Use the `permission` field to control tool behavior. You can allow, deny, or require approval for each tool.
2315

2416
```json title="opencode.json"
2517
{
2618
"$schema": "https://opencode.ai/config.json",
27-
"tools": {
28-
"write": false,
29-
"bash": false,
30-
"webfetch": true
19+
"permission": {
20+
"edit": "deny",
21+
"bash": "ask",
22+
"webfetch": "allow"
3123
}
3224
}
3325
```
3426

35-
You can also use wildcards to control multiple tools at once. For example, to disable all tools from an MCP server:
27+
You can also use wildcards to control multiple tools at once. For example, to require approval for all tools from an MCP server:
3628

3729
```json title="opencode.json"
3830
{
3931
"$schema": "https://opencode.ai/config.json",
40-
"tools": {
41-
"mymcp_*": false
42-
}
43-
}
44-
```
45-
46-
---
47-
48-
### Per agent
49-
50-
Override global tool settings for specific agents using the `tools` config in the agent definition.
51-
52-
```json title="opencode.json" {3-6,9-12}
53-
{
54-
"$schema": "https://opencode.ai/config.json",
55-
"tools": {
56-
"write": true,
57-
"bash": true
58-
},
59-
"agent": {
60-
"plan": {
61-
"tools": {
62-
"write": false,
63-
"bash": false
64-
}
65-
}
32+
"permission": {
33+
"mymcp_*": "ask"
6634
}
6735
}
6836
```
6937

70-
For example, here the `plan` agent overrides the global config to disable `write` and `bash` tools.
71-
72-
You can also configure tools for agents in Markdown.
73-
74-
```markdown title="~/.config/opencode/agent/readonly.md"
75-
---
76-
description: Read-only analysis agent
77-
mode: subagent
78-
tools:
79-
write: false
80-
edit: false
81-
bash: false
82-
---
83-
84-
Analyze code without making any modifications.
85-
```
86-
87-
[Learn more](/docs/agents#tools) about configuring tools per agent.
38+
[Learn more](/docs/permissions) about configuring permissions.
8839

8940
---
9041

@@ -101,8 +52,8 @@ Execute shell commands in your project environment.
10152
```json title="opencode.json" {4}
10253
{
10354
"$schema": "https://opencode.ai/config.json",
104-
"tools": {
105-
"bash": true
55+
"permission": {
56+
"bash": "allow"
10657
}
10758
}
10859
```
@@ -118,8 +69,8 @@ Modify existing files using exact string replacements.
11869
```json title="opencode.json" {4}
11970
{
12071
"$schema": "https://opencode.ai/config.json",
121-
"tools": {
122-
"edit": true
72+
"permission": {
73+
"edit": "allow"
12374
}
12475
}
12576
```
@@ -135,14 +86,18 @@ Create new files or overwrite existing ones.
13586
```json title="opencode.json" {4}
13687
{
13788
"$schema": "https://opencode.ai/config.json",
138-
"tools": {
139-
"write": true
89+
"permission": {
90+
"edit": "allow"
14091
}
14192
}
14293
```
14394

14495
Use this to allow the LLM to create new files. It will overwrite existing files if they already exist.
14596

97+
:::note
98+
The `write` tool is controlled by the `edit` permission, which covers all file modifications (`edit`, `write`, `patch`, `multiedit`).
99+
:::
100+
146101
---
147102

148103
### read
@@ -152,8 +107,8 @@ Read file contents from your codebase.
152107
```json title="opencode.json" {4}
153108
{
154109
"$schema": "https://opencode.ai/config.json",
155-
"tools": {
156-
"read": true
110+
"permission": {
111+
"read": "allow"
157112
}
158113
}
159114
```
@@ -169,8 +124,8 @@ Search file contents using regular expressions.
169124
```json title="opencode.json" {4}
170125
{
171126
"$schema": "https://opencode.ai/config.json",
172-
"tools": {
173-
"grep": true
127+
"permission": {
128+
"grep": "allow"
174129
}
175130
}
176131
```
@@ -186,8 +141,8 @@ Find files by pattern matching.
186141
```json title="opencode.json" {4}
187142
{
188143
"$schema": "https://opencode.ai/config.json",
189-
"tools": {
190-
"glob": true
144+
"permission": {
145+
"glob": "allow"
191146
}
192147
}
193148
```
@@ -203,8 +158,8 @@ List files and directories in a given path.
203158
```json title="opencode.json" {4}
204159
{
205160
"$schema": "https://opencode.ai/config.json",
206-
"tools": {
207-
"list": true
161+
"permission": {
162+
"list": "allow"
208163
}
209164
}
210165
```
@@ -224,8 +179,8 @@ This tool is only available when `OPENCODE_EXPERIMENTAL_LSP_TOOL=true` (or `OPEN
224179
```json title="opencode.json" {4}
225180
{
226181
"$schema": "https://opencode.ai/config.json",
227-
"tools": {
228-
"lsp": true
182+
"permission": {
183+
"lsp": "allow"
229184
}
230185
}
231186
```
@@ -243,14 +198,18 @@ Apply patches to files.
243198
```json title="opencode.json" {4}
244199
{
245200
"$schema": "https://opencode.ai/config.json",
246-
"tools": {
247-
"patch": true
201+
"permission": {
202+
"edit": "allow"
248203
}
249204
}
250205
```
251206

252207
This tool applies patch files to your codebase. Useful for applying diffs and patches from various sources.
253208

209+
:::note
210+
The `patch` tool is controlled by the `edit` permission, which covers all file modifications (`edit`, `write`, `patch`, `multiedit`).
211+
:::
212+
254213
---
255214

256215
### skill
@@ -260,14 +219,12 @@ Load a [skill](/docs/skills) (a `SKILL.md` file) and return its content in the c
260219
```json title="opencode.json" {4}
261220
{
262221
"$schema": "https://opencode.ai/config.json",
263-
"tools": {
264-
"skill": true
222+
"permission": {
223+
"skill": "allow"
265224
}
266225
}
267226
```
268227

269-
You can control approval prompts for loading skills via [permissions](/docs/permissions) using `permission.skill`.
270-
271228
---
272229

273230
### todowrite
@@ -277,16 +234,16 @@ Manage todo lists during coding sessions.
277234
```json title="opencode.json" {4}
278235
{
279236
"$schema": "https://opencode.ai/config.json",
280-
"tools": {
281-
"todowrite": true
237+
"permission": {
238+
"todowrite": "allow"
282239
}
283240
}
284241
```
285242

286243
Creates and updates task lists to track progress during complex operations. The LLM uses this to organize multi-step tasks.
287244

288245
:::note
289-
This tool is disabled for subagents by default, but you can enable it manually. [Learn more](/docs/agents/#tools)
246+
This tool is disabled for subagents by default, but you can enable it manually. [Learn more](/docs/agents/#permissions)
290247
:::
291248

292249
---
@@ -298,16 +255,16 @@ Read existing todo lists.
298255
```json title="opencode.json" {4}
299256
{
300257
"$schema": "https://opencode.ai/config.json",
301-
"tools": {
302-
"todoread": true
258+
"permission": {
259+
"todoread": "allow"
303260
}
304261
}
305262
```
306263

307264
Reads the current todo list state. Used by the LLM to track what tasks are pending or completed.
308265

309266
:::note
310-
This tool is disabled for subagents by default, but you can enable it manually. [Learn more](/docs/agents/#tools)
267+
This tool is disabled for subagents by default, but you can enable it manually. [Learn more](/docs/agents/#permissions)
311268
:::
312269

313270
---
@@ -319,8 +276,8 @@ Fetch web content.
319276
```json title="opencode.json" {4}
320277
{
321278
"$schema": "https://opencode.ai/config.json",
322-
"tools": {
323-
"webfetch": true
279+
"permission": {
280+
"webfetch": "allow"
324281
}
325282
}
326283
```
@@ -329,6 +286,30 @@ Allows the LLM to fetch and read web pages. Useful for looking up documentation
329286

330287
---
331288

289+
### question
290+
291+
Ask the user questions during execution.
292+
293+
```json title="opencode.json" {4}
294+
{
295+
"$schema": "https://opencode.ai/config.json",
296+
"permission": {
297+
"question": "allow"
298+
}
299+
}
300+
```
301+
302+
This tool allows the LLM to ask the user questions during a task. It's useful for:
303+
304+
- Gathering user preferences or requirements
305+
- Clarifying ambiguous instructions
306+
- Getting decisions on implementation choices
307+
- Offering choices about what direction to take
308+
309+
Each question includes a header, the question text, and a list of options. Users can select from the provided options or type a custom answer. When there are multiple questions, users can navigate between them before submitting all answers.
310+
311+
---
312+
332313
## Custom tools
333314

334315
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.

0 commit comments

Comments
 (0)