MCP Tool Calls Don't Trigger Plugin Hooks #1536

Closed
opened 2026-02-16 17:31:26 -05:00 by yindo · 4 comments
Owner

Originally created by @OliverGilan on GitHub (Aug 29, 2025).

Originally assigned to: @rekram1-node on GitHub.

When Opencode calls an MCP tool it doesn't trigger the tool.execute.before and tool.execute.after hooks in the plugin system.

I'm not sure if there's a practical purpose for this but it makes it really difficult (impossible?) to attach session-level metadata to an mcp tool call or inject an argument or log the outputs effectively (altho we can listen to events for that).

It's also not intuitive that this wouldn't be the case. I'd expect either:

  1. MCP tool calls trigger these hooks just like normal
  2. There might be MCP specific hooks for plugins. This might be ideal because it would be nice to attach extra metadata to a request header or something beyond just the tool args.

I can open a PR if we think this would be useful, just curious if there's a reason why this isn't the behavior today

Originally created by @OliverGilan on GitHub (Aug 29, 2025). Originally assigned to: @rekram1-node on GitHub. When Opencode calls an MCP tool it doesn't trigger the `tool.execute.before` and `tool.execute.after` hooks in the plugin system. I'm not sure if there's a practical purpose for this but it makes it really difficult (impossible?) to attach session-level metadata to an mcp tool call or inject an argument or log the outputs effectively (altho we can listen to events for that). It's also not intuitive that this wouldn't be the case. I'd expect either: 1. MCP tool calls trigger these hooks just like normal 2. There might be MCP specific hooks for plugins. This might be ideal because it would be nice to attach extra metadata to a request header or something beyond just the tool args. I can open a PR if we think this would be useful, just curious if there's a reason why this isn't the behavior today
yindo closed this issue 2026-02-16 17:31:26 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Aug 29, 2025):

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

  • #2185: Similar request for hooks for commands (plugin commands) - discusses adding hooks to capture commands before/after they're given to the LLM and allowing plugins to utilize commands
  • #1473: General hooks support request (closed) - discusses wanting hooks for automation after tasks end, though focused more on post-task automation rather than tool execution hooks specifically

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Aug 29, 2025): This issue might be a duplicate of existing issues. Please check: - #2185: Similar request for hooks for commands (plugin commands) - discusses adding hooks to capture commands before/after they're given to the LLM and allowing plugins to utilize commands - #1473: General hooks support request (closed) - discusses wanting hooks for automation after tasks end, though focused more on post-task automation rather than tool execution hooks specifically Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Aug 29, 2025):

Good callout, I will fix

@rekram1-node commented on GitHub (Aug 29, 2025): Good callout, I will fix
Author
Owner

@OliverGilan commented on GitHub (Aug 29, 2025):

That was fast lmao. Beast. Any chance we can get a release soon 🙏

@OliverGilan commented on GitHub (Aug 29, 2025): That was fast lmao. Beast. Any chance we can get a release soon 🙏
Author
Owner

@rekram1-node commented on GitHub (Aug 29, 2025):

the team hasn't done a releasse in a while so I expect they will do one very soon, idk when exactly

@rekram1-node commented on GitHub (Aug 29, 2025): the team hasn't done a releasse in a while so I expect they will do one very soon, idk when exactly
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1536