smithery/ozand

create-custom-tool

Guide for creating custom Opencode tools (JS/TS or Python)

Installation

$ npx skills add smithery/ozand --skill create-custom-tool

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Declared

Skill metadata

Parsed from SKILL.md frontmatter.

Declared agents opencode

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,621 B
  • docs SUMMARY.md 84 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

Creating Custom Tools for Opencode

This skill provides templates and rules for creating custom tools in .opencode/tools/.

1. JavaScript/TypeScript Tool (Recommended)

Opencode uses zod for schema definition.

Template:

import { tool } from "opencode";

export const myTool = tool({
  description: "Description of what the tool does",
  parameters: tool.schema.object({
    argName: tool.schema.string().describe("Description of the argument"),
    optionalArg: tool.schema.number().optional()
  }),
  execute: async ({ argName, optionalArg }) => {
    // Tool logic here
    console.log(`Executing with ${argName}`);
    return "Result string";
  }
});

2. Python Tool Wrapper (via Bun)

You can wrap Python scripts.

Template:

import { tool } from "opencode";

export const pythonWrapper = tool({
  description: "Wraps a python script",
  parameters: tool.schema.object({
    input: tool.schema.string()
  }),
  execute: async ({ input }) => {
    // Assumes the script is in .opencode/scripts/
    const result = await Bun.$`python3 .opencode/scripts/myscript.py ${input}`.text();
    return result;
  }
});

Rules

  1. Location: Save files in .opencode/tools/.
  2. Naming: Export names become tool names (e.g., export const search -> tool_search or just search depending on loading).
  3. Dependencies: If using external npm packages, ensure a package.json exists in .opencode/tools/ or .opencode/plugins/ and run bun install.