opencode: add custom tools support

Adds support for custom tools - user-defined functions that the LLM can
call during conversations. Custom tools work alongside opencode's built-in
tools and are configured through the new `tools` option.

The configuration follows the same pattern as other opencode settings like
`agents` and `commands`, supporting:
- Inline TypeScript content
- Individual file paths
- Bulk directory imports
This commit is contained in:
Thierry Delafontaine 2026-01-04 13:19:56 +01:00 committed by Austin Horstman
parent 081234b704
commit b1b1c68033
11 changed files with 213 additions and 0 deletions

View file

@ -0,0 +1,11 @@
import { tool } from "@opencode-ai/plugin"
export default tool({
description: "Test tool for unit testing",
args: {
input: tool.schema.string().describe("Test input parameter"),
},
async execute(args) {
return `Processed: ${args.input}`
},
})