docs: adding tools doc

This commit is contained in:
Jay V
2025-10-08 15:58:57 -04:00
parent 7be9a84b72
commit f3b5021936
6 changed files with 36 additions and 32 deletions

View File

@@ -74,6 +74,7 @@ export default defineConfig({
{ {
label: "Configure", label: "Configure",
items: [ items: [
"tools",
"rules", "rules",
"agents", "agents",
"models", "models",

View File

@@ -303,27 +303,33 @@ Use the `model` config to override the default model for this agent. Useful for
Control which tools are available in this agent with the `tools` config. You can enable or disable specific tools by setting them to `true` or `false`. Control which tools are available in this agent with the `tools` config. You can enable or disable specific tools by setting them to `true` or `false`.
```json title="opencode.json" ```json title="opencode.json" {3-6,9-12}
{ {
"$schema": "https://opencode.ai/config.json",
"tools": {
"write": true,
"bash": true
},
"agent": { "agent": {
"readonly": { "plan": {
"tools": { "tools": {
"write": false, "write": false,
"edit": false, "bash": false
"bash": false,
"read": true,
"grep": true,
"glob": true
} }
} }
} }
} }
``` ```
:::note
The agent-specific config overrides the global config.
:::
You can also use wildcards to control multiple tools at once. For example, to disable all tools from an MCP server: 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" ```json title="opencode.json"
{ {
"$schema": "https://opencode.ai/config.json",
"agent": { "agent": {
"readonly": { "readonly": {
"tools": { "tools": {
@@ -336,27 +342,7 @@ You can also use wildcards to control multiple tools at once. For example, to di
} }
``` ```
If no tools are specified, all tools are enabled by default. [Learn more about tools](/docs/tools).
---
#### Available tools
Here are all the tools can be controlled through the agent config.
| Tool | Description |
| ----------- | ----------------------- |
| `bash` | Execute shell commands |
| `edit` | Modify existing files |
| `write` | Create new files |
| `read` | Read file contents |
| `grep` | Search file contents |
| `glob` | Find files by pattern |
| `list` | List directory contents |
| `patch` | Apply patches to files |
| `todowrite` | Manage todo lists |
| `todoread` | Read todo lists |
| `webfetch` | Fetch web content |
--- ---

View File

@@ -86,6 +86,24 @@ You can configure TUI-specific settings through the `tui` option.
--- ---
### Tools
You can manage the tools an LLM can use through the `tools` option.
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"tools": {
"write": false,
"bash": false
}
}
```
[Learn more about tools here](/docs/tools).
---
### Models ### Models
You can configure the providers and models you want to use in your OpenCode config through the `provider`, `model` and `small_model` options. You can configure the providers and models you want to use in your OpenCode config through the `provider`, `model` and `small_model` options.

View File

@@ -3,7 +3,7 @@ title: Custom Tools
description: Create tools the LLM can call in opencode. description: Create tools the LLM can call in opencode.
--- ---
Custom tools are functions you create that the LLM can call during conversations. They work alongside opencode's built-in tools like `read`, `write`, and `bash`. Custom tools are functions you create that the LLM can call during conversations. They work alongside opencode's [built-in tools](/docs/tools) like `read`, `write`, and `bash`.
--- ---

View File

@@ -303,7 +303,7 @@ Internally, tools like `grep`, `glob`, and `list` use [ripgrep](https://github.c
--- ---
### Override ignore patterns ### Ignore patterns
To include files that would normally be ignored, create a `.ignore` file in your project root. This file can explicitly allow certain paths. To include files that would normally be ignored, create a `.ignore` file in your project root. This file can explicitly allow certain paths.
@@ -314,5 +314,3 @@ To include files that would normally be ignored, create a `.ignore` file in your
``` ```
For example, this `.ignore` file allows ripgrep to search within `node_modules/`, `dist/`, and `build/` directories even if they're listed in `.gitignore`. For example, this `.ignore` file allows ripgrep to search within `node_modules/`, `dist/`, and `build/` directories even if they're listed in `.gitignore`.
The `.ignore` file follows ripgrep's ignore file syntax. Patterns prefixed with `!` negate the ignore rules from `.gitignore`.

View File

@@ -66,6 +66,7 @@ You can also access our models through the following API endpoints.
| ---------------- | ---------------- | --------------------------------------------- | --------------------------- | | ---------------- | ---------------- | --------------------------------------------- | --------------------------- |
| GPT 5 | gpt-5 | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` | | GPT 5 | gpt-5 | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
| GPT 5 Codex | gpt-5-codex | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` | | GPT 5 Codex | gpt-5-codex | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
| Claude Sonnet 4.5 | claude-sonnet-4-5 | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
| Claude Sonnet 4 | claude-sonnet-4 | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` | | Claude Sonnet 4 | claude-sonnet-4 | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
| Claude Haiku 3.5 | claude-3-5-haiku | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` | | Claude Haiku 3.5 | claude-3-5-haiku | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
| Claude Opus 4.1 | claude-opus-4-1 | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` | | Claude Opus 4.1 | claude-opus-4-1 | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |