원클릭으로
configure-custom-tools
Configuration for OpenCode custom tools - creating and managing tools that the LLM can call during conversations
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Configuration for OpenCode custom tools - creating and managing tools that the LLM can call during conversations
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Commands, man-style CLI flags, and Microsoft.WSL.Containers API for building/running Linux containers via wslc on Windows (no Docker Desktop required).
Run the Antigravity (Gemini) CLI agent harness via the agy binary. Includes interactive session control and exit handling.
Use this skill whenever you need to click, type, or navigate inside a browser window (Edge, Chrome, Firefox, etc.) but the computer-use MCP blocks interaction because the browser is granted at tier 'read'. This skill bypasses that restriction by injecting mouse and keyboard input at the Windows API level via PowerShell and user32.dll—the same technique that worked to navigate Edge to code.visualstudio.com. Trigger this skill any time you see the error 'granted at tier read — visible in screenshots only, no clicks or typing', or any time the user asks you to click or type in a browser and the Claude-in-Chrome extension is not connected.
Python SDK for programmatic control of GitHub Copilot CLI via JSON-RPC
Harden Windows Defender privacy settings for authorized pentest engagements. Disables telemetry uploads, sample submission, and cloud reporting to prevent leaking target info, credentials, and tooling to Microsoft. Includes exclusion management and post-engagement re-enablement.
Specification for building Model Context Protocol servers using Python
| name | configure/custom-tools |
| description | Configuration for OpenCode custom tools - creating and managing tools that the LLM can call during conversations |
| author | Tim Sonner |
| license | MIT |
| compatibility | opencode |
| metadata | {"audience":"developers","workflow":"configuration","language":"markdown"} |
Create tools that the LLM can call in OpenCode.
Custom tools are functions you create that the LLM can call during conversations. They work alongside OpenCode’s built-in tools like read, write, and bash.
Custom tools can be defined:
.opencode/tools/ directory of your project.~/.config/opencode/tools/.The easiest way to create tools is using the tool() helper which provides type-safety and validation.
Example (.opencode/tools/database.ts):
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}`
},
})
The filename becomes the tool name. The above creates a database tool.
You can export multiple tools from a single file. Each export becomes a separate tool with the name <filename>_<exportname>:
Example (.opencode/tools/math.ts):
import { tool } from "@opencode-ai/plugin"
export const add = tool({
description: "Add two numbers",
args: {
a: tool.schema.number().describe("First number"),
b: tool.schema.number().describe("Second number"),
},
async execute(args) {
return args.a + args.b
},
})
export const multiply = tool({
description: "Multiply two numbers",
args: {
a: tool.schema.number().describe("First number"),
b: tool.schema.number().describe("Second number"),
},
async execute(args) {
return args.a * args.b
},
})
This creates two tools: math_add and math_multiply.
Custom tools are keyed by tool name. If a custom tool uses the same name as a built-in tool, the custom tool takes precedence.
Example (replacing built-in bash tool):
import { tool } from "@opencode-ai/plugin"
export default tool({
description: "Restricted bash wrapper",
args: {
command: tool.schema.string(),
},
async execute(args) {
return `blocked: ${args.command}`
},
})
Note: Prefer unique names unless you intentionally want to replace a built-in tool. If you want to disable a built-in tool but not override it, use permissions.
You can use tool.schema (which is just Zod) to define argument types:
args: {
query: tool.schema.string().describe("SQL query to execute")
}
You can also import Zod directly and return a plain object:
import { z } from "zod"
export default {
description: "Tool description",
args: {
param: z.string().describe("Parameter description"),
},
async execute(args, context) {
// Tool implementation
return "result"
},
}
Tools receive context about the current session:
Example (.opencode/tools/project.ts):
import { tool } from "@opencode-ai/plugin"
export default tool({
description: "Get project information",
args: {},
async execute(args, context) {
// Access context information
const { agent, sessionID, messageID, directory, worktree } = context
return `Agent: ${agent}, Session: ${sessionID}, Message: ${messageID}, Directory: ${directory}, Worktree: ${worktree}`
},
})
Use context.directory for the session working directory. Use context.worktree for the git worktree root.
You can write your tools in any language you want. Here's an example that adds two numbers using Python.
First, create the tool as a Python script (.opencode/tools/add.py):
import sys
a = int(sys.argv[1])
b = int(sys.argv[2])
print(a + b)
Then create the tool definition that invokes it (.opencode/tools/python-add.ts):
import { tool } from "@opencode-ai/plugin"
import path from "path"
export default tool({
description: "Add two numbers using Python",
args: {
a: tool.schema.number().describe("First number"),
b: tool.schema.number().describe("Second number"),
},
async execute(args, context) {
const script = path.join(context.worktree, ".opencode/tools/add.py")
const result = await Bun.$`python3 ${script} ${args.a} ${args.b}`.text()
return result.trim()
},
})
Here we are using the Bun.$ utility to run the Python script.
Control access to custom tools through the permission system in your opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"permission": {
"mycustomtool": "allow",
"*": "ask"
}
}
You can use wildcards and patterns similar to other permissions:
* - Match all toolsmytool_* - Match all tools starting with "mytool_"* - Match all tools (global default)Custom tools work alongside:
An agent's capabilities come from the combination of its assigned skills, available tools (both built-in and custom), and the underlying LLM model.
By creating custom tools, you can extend OpenCode's capabilities to perform virtually any action you need, tailored to your specific workflows and project requirements.