Skip to content

MCP Tool Calls Don't Trigger Plugin Hooks #2319

Closed

Description

@OliverGilan

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

Activity

  1. github-actions commented on Aug 30, 2025

    @github-actions
    Contributor

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

    • Hooks for commands (Plugin Commands) #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
    • Hooks support? #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.

  2. self-assigned this
    on Aug 30, 2025
  3. rekram1-node commented on Aug 30, 2025

    @rekram1-node
    Collaborator

    Good callout, I will fix

  4. OliverGilan commented on Aug 30, 2025

    @OliverGilan
    Author

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

  5. rekram1-node commented on Aug 30, 2025

    @rekram1-node
    Collaborator

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

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