Skip to content

[FEATURE]: Design V2 per-model tool filtering #34491

Closed as not planned
Closed as not planned

Description

@opencode-agent

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Design how V2 controls tool availability per model/provider.

This is intentionally a placeholder/design issue that needs follow-up.

Context from the V2 beta discussion:

  • Some models should not receive every tool.
  • Example concern: GPT receiving edit, patch, and write tools simultaneously when model-specific prompting/tooling may want a narrower set.
  • The old model-specific transform logic should become a cleaner plugin/hook/materialization mechanism.

Expected scope:

  • Define whether filtering is configured by model, provider, agent, plugin, or request hook.
  • Decide precedence when multiple plugins/configs affect the tool list.
  • Ensure TUI/client can understand unavailable tools if needed.
  • Add follow-up implementation tasks after the design is clear.

Activity

  1. github-actions commented on Jun 29, 2026

    @github-actions
    Contributor

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

    • [FEATURE]: ToolBuild hook #28353: Requests PreToolBuild/PostToolBuild hooks for runtime manipulation of the tool list before it is sent to the LLM — closely related to the per-model tool filtering design described here.
  2. rekram1-node commented on Jun 30, 2026

    @rekram1-node
    Contributor

    Shipped a band-aid fix in #34558 (merged): ToolRegistry.materialize now takes the resolved model and gates the edit-tool family the way V1 did — OpenAI/GPT models get apply_patch, every other model gets edit/write. This unblocks the immediate concern (GPT no longer receives edit + write + apply_patch simultaneously).

    This is intentionally minimal and does not address the actual design ask in this issue, so keeping it open. Still needed for the proper solution:

    • Make filtering configurable (by model / provider / agent / plugin / request hook) instead of a hardcoded provider+id string check in materialize.
    • Define precedence when multiple configs/plugins affect the tool list.
    • TUI/client awareness of unavailable tools.

    Note: a plugin-based approach isn't feasible today — the V2 PluginHost has no tool capability and there's no model-aware turn-time hook (only aisdk, which sees the model but operates on the language-model object, not the tool roster). The proper design would need that infra first. The architecture already earmarks materialize as the filtering seam (tool/builtins.ts: "provider/model filtering belongs to a future materialization phase"), so the band-aid lives in the right place — it just needs to become driven by configuration rather than hardcoded.

    Related: #19942.

  3. kitlangton commented on Jul 4, 2026

    @kitlangton
    Contributor

    #34558 fixed the immediate failure mode and added coverage: GPT/OpenAI models receive apply_patch, while other models receive edit/write.

    Keeping this open for the unresolved design: replace the hardcoded provider/model check with configurable policy, define composition and precedence across model/provider/agent/plugin inputs, and decide whether unavailable tools require client representation.

  4. opencode-agent commented on Jul 5, 2026

    @opencode-agent
    ContributorAuthor

    Superseded by #35408, which defines the shared V2 model-context hook and includes per-model tool filtering. The remaining precedence and client-representation questions have been carried into that tracker.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions