Skip to content

Custom tool argument descriptions are not passed to agent, and tool argument schemas aren't actually checked #15956

Closed

Description

@ashleytowner

Description

Custom tools -- tools defined on the user's machine, not within opencode -- do not have their metadata properly passed into the LLM, and do not have the arguments provided during calls actually checked against the schema.

This results in bad tool calls from the LLM, which then go initially unnoticed because the inputs aren't actually checked against the schema.

Plugins

None, just the custom tool provided in bug description

OpenCode version

1.2.16

Steps to reproduce

  1. Create a custom tool in ~/.config/opencode/tools/ with some arguments with descriptions on them

e.g. ~/.config/opencode/tools/search.ts

import { tool } from '@opencode-ai/plugin'

export default tool({
  description: 'search custom docs',
  args: {
    query: tool.schema.string().describe('query to search for'),
    type: tool.schema
      .union([tool.schema.literal('regex'), tool.schema.literal('text')])
      .describe('regex or text mode'),
  },
  async execute() {
    return 'ok'
  },
})
  1. Start opencode and have it use this tool, see that it will likely provide an incorrect parameter. Note that there is no error from the zod schema
  2. Ask it what the descriptions for the parameters are, and see that it will hallucinate something. Also note it won't know the correct type, and will report that type should be either a string or string[], rather than what it actually should be: "regex" | "text"

Expected Outcome

  • When an incorrect value is passed in that violates the schema, the args should actually be checked against the schema and an error shoudl be produced
  • The description & other metadata should actually be passed to the LLM, so it isn't hallucinating the uses of each field.

Screenshot and/or share link

No response

Operating System

macOS Sequoia 15.6.1

Terminal

Ghostty

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 4, 2026
  2. github-actions commented on Mar 4, 2026

    @github-actions
    Contributor

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

  3. ashleytowner commented on Mar 4, 2026

    @ashleytowner
    Author

    Yes, this really is a duplicate of #4357. I'm gonna close this ticket in favour of that.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions