Skip to content

[FEATURE]: Pass sessionID, model, and agent info to tool.definition hook #17954

Closed as not planned

Description

@ualtinok

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

The tool.definition hook currently receives only { toolID: string } as input. Plugins that provide tools have no way to know which model or agent will use those tools, and lack session context, making it impossible to adapt tool descriptions or parameters based on model capabilities or session state.

Use case: Plugins providing advanced code exploration tools (symbol zoom, call graph navigation, AST pattern matching) alongside simple tools (read, write, edit) need to conditionally simplify or hide tool descriptions for less capable models that waste tokens on failed calls to advanced tools.

Proposed change: Pass sessionID, model ({ providerID, modelID }), and agent info through to the tool.definition hook. The model and agent variables are already in scope at the call site in ToolRegistry.tools(). Refactoring tools() to accept a single input object { model, sessionID, agent? } also makes the API cleaner for future additions.

This supersedes #17334 / #17331 by including sessionID alongside model and agent in a single change.

Operating System

macOS

Activity

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

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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