We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Tools

Tools are how an agent does stuff, rather than just talking about stuff.

Without tools, an LLM can only respond with text in a chat window. Sure, it can suggest that you run a command, describe a refactor, or explain how to debug something, but it can't actually do it for you.

With tools, it can.

What Is a Tool?

A tool is essentially a function the model is allowed to call. For example, OpenCode comes with a read tool that lets the model read files.

The agent harness tells the model which tools are available, what each one does, and what arguments each accepts.

Say the model wants to read a file. It can do so by generating a tool call – a structured request naming the tool and supplying its arguments, kinda like this:

{
  "tool": "read",
  "args": {
    "path": "internal/api/handlers.go"
  }
}

OpenCode parses that request, calls the tool, and adds the contents of the file that it read back into the model's context. The model can then use that information to respond to you or choose another tool call.