[PR #3573] fix: preserve metadata from MCP tool results in tool.execute.after hook #10698

Closed
opened 2026-02-16 18:15:26 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/3573

State: closed
Merged: Yes


Currently updating metadata in tool.execute.after hook works for regular tools, but NOT for MCP tools.

This PR fixes it.


export const MCPMetadataExamplePlugin = async ({}) => {
  return {
    'tool.execute.after': async (input, output) => {
      // CURRENTLY this works for regular tools, but not for MCP tools
      output.metadata = {
        custom: true,
      }
    },
  }
}

closes: #3574

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/3573 **State:** closed **Merged:** Yes --- Currently updating metadata in `tool.execute.after` hook works for regular tools, but NOT for MCP tools. This PR fixes it. ```typescript export const MCPMetadataExamplePlugin = async ({}) => { return { 'tool.execute.after': async (input, output) => { // CURRENTLY this works for regular tools, but not for MCP tools output.metadata = { custom: true, } }, } } ``` closes: #3574
yindo added the pull-request label 2026-02-16 18:15:26 -05:00
yindo closed this issue 2026-02-16 18:15:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10698