Skip to content

allow running custom tools without external dependencies #2802

Closed

Description

@kynnyhsap

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

Activity

  1. github-actions commented on Sep 26, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. rekram1-node commented on Sep 26, 2025

    @rekram1-node
    Contributor

    @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

  3. dehidehidehi commented on Nov 21, 2025

    @dehidehidehi

    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?

  4. rekram1-node commented on Nov 21, 2025

    @rekram1-node
    Contributor

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

  5. dehidehidehi commented on Nov 21, 2025

    @dehidehidehi

    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
    
  6. HelloGGX commented on Dec 19, 2025

    @HelloGGX
    Contributor

    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: #5797

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions