Skip to content

MCP Tool Calls Don't Trigger Plugin Hooks #2319

@OliverGilan

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

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