opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: MCP Tool Output

Open xpcmdshell opened this issue 2 weeks ago • 5 comments

Feature hasn't been suggested before.

  • [x] I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Description:

MCP tool outputs are not displayed in the TUI. When using any MCP server, you only see the tool name and input parameters, but never the actual output/result. I often times want to see what the tool actually returned. You end up having to rely on manually asking the model to duplicate all the output for you.

Root cause:

GenericTool in packages/opencode/src/cli/cmd/tui/routes/session/index.tsx (lines 1515-1520) ignores props.output:

  function GenericTool(props: ToolProps<any>) {
    return (
      <ToolTitle icon="⚙" fallback="Writing command..." when={true}>
        {props.tool} {input(props.input)}
      </ToolTitle>
    )
  }

Built-in tools like bash and patch render their output, but MCP tools fall back to GenericTool which discards it.

Suggested fix:

Add output rendering to GenericTool, gated by the existing tool_details_visibility setting (or a new config option):

  function GenericTool(props: ToolProps<any>) {
    const { theme } = useTheme()
    return (
      <>
        <ToolTitle icon="⚙" fallback="Writing command..." when={true}>
          {props.tool} {input(props.input)}
        </ToolTitle>
        <Show when={props.output}>
          <box>
            <text fg={theme.text}>{props.output?.trim()}</text>
          </box>
        </Show>
      </>
    )
  }

This follows the same pattern used by the patch tool renderer (lines 1838-1856).

Ideally this would be configurable - either via the existing tool_details keybind toggle, or a separate config option like tui.mcp_tool_output: true/false.

Impact:

Anyone using MCP servers cannot see tool results in the TUI, making it difficult to understand what the model is working with.

xpcmdshell avatar Jan 01 '26 22:01 xpcmdshell