allow running custom tools without external dependencies #1842

Closed
opened 2026-02-16 17:32:53 -05:00 by yindo · 6 comments
Owner

Originally created by @kynnyhsap on GitHub (Sep 26, 2025).

Originally assigned to: @thdxr on GitHub.

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

Image Image
Originally created by @kynnyhsap on GitHub (Sep 26, 2025). Originally assigned to: @thdxr on GitHub. ## 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 ```typescript export default { description: "", args: { arg1: { type: 'string' }, }, async execute(args, _context) { } }; ``` v0.11.8 <img width="1718" height="216" alt="Image" src="https://github.com/user-attachments/assets/f07dd651-4371-4dba-a587-c17d5e0e96ba" /> <img width="1650" height="1262" alt="Image" src="https://github.com/user-attachments/assets/1b286a62-9db7-4e6b-8f5e-0d6fd7fbdc7b" />
yindo closed this issue 2026-02-16 17:32:53 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 26, 2025):

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.

@github-actions[bot] commented on GitHub (Sep 26, 2025): 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.
Author
Owner

@rekram1-node commented on GitHub (Sep 26, 2025):

@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

@rekram1-node commented on GitHub (Sep 26, 2025): @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
Author
Owner

@dehidehidehi commented on GitHub (Nov 21, 2025):

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?

@dehidehidehi commented on GitHub (Nov 21, 2025): 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?
Author
Owner

@rekram1-node commented on GitHub (Nov 21, 2025):

We automatically install the dep, but ig it is failing for u? and is there no node_modules for it?

@rekram1-node commented on GitHub (Nov 21, 2025): We automatically install the dep, but ig it is failing for u? and is there no node_modules for it?
Author
Owner

@dehidehidehi commented on GitHub (Nov 21, 2025):

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/plugin@1.0.86","--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/plugin@1.0.86
@dehidehidehi commented on GitHub (Nov 21, 2025): 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/plugin@1.0.86","--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/plugin@1.0.86 ```
Author
Owner

@HelloGGX commented on GitHub (Dec 19, 2025):

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

@HelloGGX commented on GitHub (Dec 19, 2025): > 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
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1842