Skip to content

custom tool with plain-object args silently fails to register #45532

Closed as not planned

Description

@yvonnedevlinrh

Description

A custom tool whose args are a plain JS object (not a Zod schema) never registers, and no error or warning is printed. tool() expects z.ZodRawShape (packages/plugin/src/tool.ts:45); a plain object is neither coerced nor rejected — it's silently dropped. Expected: either accept a plain JSON-schema object, or emit a clear "args must be a Zod schema" error at registration.

Workaround: use a Zod schema for args.

Plugins

none

OpenCode version

1.18.16

Steps to reproduce

  1. Define a custom tool in .opencode/tools/ with args as a plain object,
    e.g. args: { foo: "string" }.
  2. Start OpenCode (or run headless).
  3. The tool is absent from the tool list with no diagnostic message.

Screenshot and/or share link

No response

Operating System

Ubuntu 24.04 (aarch64)

Terminal

non-interactive (openshell sandbox exec -- sh -c, --no-tty)

Activity

  1. fancive commented on Aug 30, 2026

    @fancive
    Contributor

    I can take this. I have a small validation fix with regression coverage and will open a PR shortly.

  2. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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