Skip to content

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

@ualtinok

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions