programs.opencode.tools
Home-Manager option
(attribute set of (strings concatenated with "\n" or absolute path)) or absolute path
Custom tools for opencode. This option can either be: - An attribute set defining tools - A path to a directory containing multiple tool files If an attribute set is used, the attribute name becomes the tool filename, and the value is either: - Inline content as a string (creates opencode/tools/<name>.ts) - A path to a file (creates opencode/tools/<name>.ts or opencode/tools/<name>.js) If a path is used, it is expected to contain tool files. The directory is symlinked to $XDG_CONFIG_HOME/opencode/tools/. See <https://opencode.ai/docs/tools/> for the documentation.
type: (attribute set of (strings concatenated with "\n" or absolute path)) or absolute pathDefault
{ }Example
declared in: <home-manager/modules/programs/opencode.nix>source unavailable{ database-query = '' import { tool } from "@opencode-ai/plugin" export default tool({ description: "Query the project database", args: { query: tool.schema.string().describe("SQL query to execute"), }, async execute(args) { // Your database logic here return `Executed query: ${args.query}` }, }) ''; # Or reference an existing file api-client = ./tools/api-client.ts; }