Skip to content

tool.execute.before cannot replace missing tool call arguments #20013

@phuctm97

Description

@phuctm97

Description

tool.execute.before receives an output object with args, but the tool wrapper still executes the tool with the original args variable. If a tool call starts with missing arguments, a hook cannot replace them with a new object.

This affects both native tools and MCP tools. A simple reproducer is a hook that sets output.args = { injected: true } for a zero-arg tool call. The tool still runs without the injected arguments unless the wrapper uses the mutated hook output.

Plugins

A local plugin using tool.execute.before to attach metadata to tool arguments.

OpenCode version

dev branch

Steps to reproduce

  1. Register a tool that can be called without arguments.
  2. Add a tool.execute.before hook that replaces output.args with a new object.
  3. Call the tool without arguments.
  4. Observe that the tool executes with the original missing args instead of the replacement object.

Screenshot and/or share link

Not applicable.

Operating System

macOS

Terminal

zsh

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