Skip to main content
Legacy reference: this page describes OCX 2 for OpenCode V1. For OCX 3 and OpenCode V2, see the V2 documentation.

Overview

Custom tools are functions the LLM can call during conversations. They extend what AI agents can do beyond built-in capabilities.

Tool Locations

Basic Tool Structure

The filename becomes the tool name.

Multiple Tools Per File

Creates tools: math_add and math_multiply (filename prefix + export name).

Tool Context

Access session and agent information:

Using External Languages

Wrap non-TypeScript tools with a TypeScript shell:
.opencode/tool/add.py
.opencode/tool/python-add.ts

See Also