Search⌘ K
AI Features

Understanding OpenCode’s Tools

Explore how OpenCode's tools enable AI to interact with your codebase by reading files, modifying code, running commands, and navigating projects under strict permission controls. Understand the core tools used in everyday coding workflows and how configuring these permissions helps maintain safety and control while collaborating with the AI.

So far, OpenCode can feel like it’s doing a lot behind the scenes. We ask questions, it generates plans, applies changes, and usually produces a working result. At this point, it’s useful to understand how OpenCode actually takes action inside your project.

When we use OpenCode, it can feel like the assistant is directly reading files, editing code, and running commands on its own. In reality, none of that is happening automatically.

Large language models cannot act on their own. They cannot read files, modify code, or execute commands. All they can do is generate text and request actions. Tools are the bridge between the model’s reasoning and the real world.

OpenCode exposes a set of tools that the model can call to interact with our project. Every time OpenCode reads a file, edits code, searches the repository, or runs a shell command, it’s using a tool. Understanding this makes OpenCode’s behavior far less mysterious and much easier to control.

How does OpenCode control what the model is allowed to do?

OpenCode enforces a strict boundary between reasoning and execution through permissions. Every tool can be explicitly allowed, denied, or gated behind approval.

These permissions are configured in an opencode.json file at the root of the project. This file defines what the agent is allowed to do inside our codebase.

For example, we might want OpenCode to read files freely, ask before running shell commands, and completely deny file modifications:

{
"$schema": "https://opencode.ai/config.json",
"permission": {
"edit": "deny",
"bash": "ask",
"webfetch": "allow"
}
}

This setup lets you control how much autonomy OpenCode has. When you’re exploring a project, you might give it broad permissions. In more sensitive repos, you can restrict what it’s allowed to do. You’re always in control.

Which tools matter most for everyday use?

OpenCode includes many tools, but only a small subset accounts for most real-world behavior. If we understand these core tools well, we understand how OpenCode actually works in practice.

The most important tools fall into three categories: reading code, changing code, and navigating the project.

How does OpenCode read our codebase?

...