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

Custom Tools

Plugins can register custom tools when OpenCode's built-in tools can't handle a specific job.

Once a custom tool is set up, it participates in the same tool system as the built-ins.

When Should You Make a Tool?

Custom tools are useful for specialized actions the agent performs repeatedly:

  • Querying an internal database safely
  • Calling a project-specific API
  • Wrapping a complicated script behind a simpler interface
  • Looking up metadata from a system the repo depends on

The main benefit is a clean, task-specific interface instead of forcing the agent to reinvent the same script every time it needs that action.

Every OpenCode custom tool comes from a plugin. Defining a new tool for a project/repo just means adding a small plugin file under .opencode/plugins/.