Skip to content

Proposal: unify tool schema conversion into a single code path #20919

Closed

Description

@jbmml

I'm working on a PAI-to-OpenCode port using non-Claude models (MiniMax, Gemini, Qwen via MLX) and have been tracing tool-calling failures back to schema conversion inconsistencies. While investigating #4357 and filing #20807, I found that the codebase has 6 separate places that convert tool schemas, using 3 different methods, with inconsistent provider transform application.

The problem in brief:

Each new consumer has to independently decide how to convert, whether to apply provider transforms, and which converter to use. The zodToJsonSchema breakage proves the pattern fails at scale.

What I'd like to propose: A tool/schema.ts module with one toJsonSchema(schema, model?) function that all 6 paths use. It would handle Zod detection, provider-specific transforms, and (if needed) cross-instance plugin metadata rehydration in one place.

I have a detailed test plan covering baseline behavior snapshots, provider transform application, cross-instance Zod metadata, and end-to-end acceptance tests. Happy to share if the team is interested.

Before putting in the implementation work, I wanted to check: is this a direction the team would accept? Or is the scattered approach intentional?

Related issues this would address:

Related PRs:

Activity

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

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • This appears to be a feature request/proposal, but it doesn't use the Feature Request template. The title should start with [FEATURE]: and the issue should include the required verification checkbox confirming you've searched for existing issues.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    If you believe this was flagged incorrectly, please let a maintainer know.

  3. jbmml commented on Apr 3, 2026

    @jbmml
    Author

    Closing to refile with the correct feature request template.

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

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)needs:complianceThis means the issue will auto-close after 2 hours.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions