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
- Register a tool that can be called without arguments.
- Add a
tool.execute.before hook that replaces output.args with a new object.
- Call the tool without arguments.
- 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
Description
tool.execute.beforereceives an output object withargs, but the tool wrapper still executes the tool with the originalargsvariable. 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.beforeto attach metadata to tool arguments.OpenCode version
dev branch
Steps to reproduce
tool.execute.beforehook that replacesoutput.argswith a new object.Screenshot and/or share link
Not applicable.
Operating System
macOS
Terminal
zsh