allow running custom tools without external dependencies
problem
impossible to run custom tools from local .opencode/tool/mytool.ts folder because you either rquired to use tool.schema from @opencode-ai/plugin or z from zod
use case
running opencode form local configuraion in .opencode/ without node_modules installed there with zod or opencode plugin sdk
solution
please allow us to use json schema for args along side with zod
export default {
description: "",
args: {
arg1: { type: 'string' },
},
async execute(args, _context) { }
};
v0.11.8
This issue might be a duplicate of existing issues. Please check:
- #2718: Support metadata and output format in custom tools - discusses enhancements to custom tools functionality
Feel free to ignore if none of these address your specific case.
@kynnyhsap soon I think opencode will be resolving these dependencies automatically for you (just btw) so u wouldn't have to create a node_modules
Hello, I also am encountering this issue:
error: Cannot find module '@opencode-ai/plugin' from '/home/[redacted]/dot-config/opencode/tool/list-agents.ts'
Is it still mandatory to actively create a node_modules folder everywhere we run opencode if we want custom tools to work?
We automatically install the dep, but ig it is failing for u? and is there no node_modules for it?
I cannot reproduce the issue, I guess we are all good; Looking at the file logs produced by opencode helps knowing where the package is installed
INFO 2025-11-21T21:23:13 +9ms service=bun cmd=["/home/dehi/.opencode/bin/opencode","add","@opencode-ai/[email protected]","--exact"] cwd=/home/dehi/.config/opencode running
INFO 2025-11-21T21:23:13 +15ms service=bun code=0 stdout=bun add v1.3.3 (274e01c7)
installed @opencode-ai/[email protected]
We automatically install the dep, but ig it is failing for u? and is there no node_modules for it?
I submitted a pull request to fix this issue: https://github.com/sst/opencode/pull/5797