anomalyco / anomalyco/opencode

custom tool with plain-object args silently fails to register

Open
#45,532 1 comment 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Aug 27, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.