[FEATURE]: MCP Tool Output #4067

Open
opened 2026-02-16 17:42:30 -05:00 by yindo · 10 comments
Owner

Originally created by @xpcmdshell on GitHub (Jan 1, 2026).

Originally assigned to: @rekram1-node on GitHub.

Feature hasn't been suggested before.

  • 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.

Originally created by @xpcmdshell on GitHub (Jan 1, 2026). Originally assigned to: @rekram1-node on GitHub. ### 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: ```tsx 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): ```tsx 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.
yindo added the opentuidiscussion labels 2026-02-16 17:42:30 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 1, 2026):

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

  • #5358: [FEATURE]: Tool output preview - Requests ability to see tool output (webfetch, etc.) via a preview dialog
  • #3790: [FEATURE]: Have the ability to show tool raw output in OpenCode UI - Requests the ability to see custom tool output in the UI
  • #3065: Bug: Tool Calls are not shown directly if tool details are toggled off - Related issue about tool visibility/details toggle
  • #1736: TUI: Bash tool calls only show description, not actual command - Similar issue about tool information not being displayed

Feel free to ignore if your request has specific requirements not addressed by these issues.

@github-actions[bot] commented on GitHub (Jan 1, 2026): This issue might be a duplicate of existing issues. Please check: - #5358: [FEATURE]: Tool output preview - Requests ability to see tool output (webfetch, etc.) via a preview dialog - #3790: [FEATURE]: Have the ability to show tool raw output in OpenCode UI - Requests the ability to see custom tool output in the UI - #3065: Bug: Tool Calls are not shown directly if tool details are toggled off - Related issue about tool visibility/details toggle - #1736: TUI: Bash tool calls only show description, not actual command - Similar issue about tool information not being displayed Feel free to ignore if your request has specific requirements not addressed by these issues.
Author
Owner

@ai-llt commented on GitHub (Jan 4, 2026):

I searched all over but couldn't find the relevant settings, which is very important for us (agent development).

@ai-llt commented on GitHub (Jan 4, 2026): I searched all over but couldn't find the relevant settings, which is very important for us (agent development).
Author
Owner

@ai-llt commented on GitHub (Jan 4, 2026):

I tried to find the most standard way to write the MCP format, but still couldn't view the return content from other tools.

@ai-llt commented on GitHub (Jan 4, 2026): I tried to find the most standard way to write the MCP format, but still couldn't view the return content from other tools.
Author
Owner

@kostrse commented on GitHub (Jan 10, 2026):

Could it be relevant that GitHub MCP get_file_contents only returns "successfully downloaded" without actually returning actual file contents to the model?

@kostrse commented on GitHub (Jan 10, 2026): Could it be relevant that GitHub MCP `get_file_contents` only returns "successfully downloaded" without actually returning actual file contents to the model?
Author
Owner

@yanosh-k commented on GitHub (Jan 18, 2026):

I think it would be better if the output is collapsible (just like the output of the bash tool). Some tools return long output and it becomes cluttered when output is displayed directly.

I've tested the following version:

function GenericTool(props: ToolProps<any>) {
  const { theme } = useTheme()
  const output = createMemo(() => props.output?.trim() ?? "")
  const [expanded, setExpanded] = createSignal(false)
  const lines = createMemo(() => output().split("\n"))
  const maxLines = 3
  const overflow = createMemo(() => lines().length > maxLines)
  const limited = createMemo(() => {
    if (expanded() || !overflow()) return output()
    return [...lines().slice(0, maxLines), "…"].join("\n")
  })

  return (
    <Show
      when={props.output}
      fallback={
        <InlineTool icon="⚙" pending="Writing command..." complete={true} part={props.part}>
          {props.tool} {input(props.input)}
        </InlineTool>
      }
    >
      <BlockTool
        title={`# ${props.tool} ${input(props.input)}`}
        part={props.part}
        onClick={overflow() ? () => setExpanded((prev) => !prev) : undefined}
      >
        <box gap={1}>
          <text fg={theme.text}>{limited()}</text>
          <Show when={overflow()}>
            <text fg={theme.textMuted}>{expanded() ? "Click to collapse" : "Click to expand"}</text>
          </Show>
        </box>
      </BlockTool>
    </Show>
  )
}

Here is how it looks (websearch-ddgs is a custom tool and tmux_list-session is an MCP tool):

https://github.com/user-attachments/assets/74eb8292-2ffc-44da-8a21-81624bd802a9

@yanosh-k commented on GitHub (Jan 18, 2026): I think it would be better if the output is collapsible (just like the output of the `bash` tool). Some tools return long output and it becomes cluttered when output is displayed directly. I've tested the following version: ```tsx function GenericTool(props: ToolProps<any>) { const { theme } = useTheme() const output = createMemo(() => props.output?.trim() ?? "") const [expanded, setExpanded] = createSignal(false) const lines = createMemo(() => output().split("\n")) const maxLines = 3 const overflow = createMemo(() => lines().length > maxLines) const limited = createMemo(() => { if (expanded() || !overflow()) return output() return [...lines().slice(0, maxLines), "…"].join("\n") }) return ( <Show when={props.output} fallback={ <InlineTool icon="⚙" pending="Writing command..." complete={true} part={props.part}> {props.tool} {input(props.input)} </InlineTool> } > <BlockTool title={`# ${props.tool} ${input(props.input)}`} part={props.part} onClick={overflow() ? () => setExpanded((prev) => !prev) : undefined} > <box gap={1}> <text fg={theme.text}>{limited()}</text> <Show when={overflow()}> <text fg={theme.textMuted}>{expanded() ? "Click to collapse" : "Click to expand"}</text> </Show> </box> </BlockTool> </Show> ) } ``` Here is how it looks (`websearch-ddgs` is a custom tool and `tmux_list-session` is an MCP tool): https://github.com/user-attachments/assets/74eb8292-2ffc-44da-8a21-81624bd802a9
Author
Owner

@rserbitar commented on GitHub (Jan 22, 2026):

I think it would be better if the output is collapsible (just like the output of the bash tool). Some tools return long output and it becomes cluttered when output is displayed directly.

Here is how it looks (websearch-ddgs is a custom tool and tmux_list-session is an MCP tool):
tool_output_after.mp4

This is great! Absolutley needed!

@rserbitar commented on GitHub (Jan 22, 2026): > I think it would be better if the output is collapsible (just like the output of the `bash` tool). Some tools return long output and it becomes cluttered when output is displayed directly. > Here is how it looks (`websearch-ddgs` is a custom tool and `tmux_list-session` is an MCP tool): > tool_output_after.mp4 This is great! Absolutley needed!
Author
Owner

@karta0807913 commented on GitHub (Jan 25, 2026):

I think it would be better if the output is collapsible (just like the output of the bash tool). Some tools return long output and it becomes cluttered when output is displayed directly.

I've tested the following version:
Here is how it looks (websearch-ddgs is a custom tool and tmux_list-session is an MCP tool):

@yanosh-k looks great! maybe you can create a PR about this change and see will they merge it?

@karta0807913 commented on GitHub (Jan 25, 2026): > I think it would be better if the output is collapsible (just like the output of the `bash` tool). Some tools return long output and it becomes cluttered when output is displayed directly. > > I've tested the following version: > Here is how it looks (`websearch-ddgs` is a custom tool and `tmux_list-session` is an MCP tool): @yanosh-k looks great! maybe you can create a PR about this change and see will they merge it?
Author
Owner

@rekram1-node commented on GitHub (Jan 25, 2026):

Yeah that's valid I like it

@rekram1-node commented on GitHub (Jan 25, 2026): Yeah that's valid I like it
Author
Owner

@cuipengfei commented on GitHub (Feb 1, 2026):

Having a settings option to control how many lines are shown of the mcp tool call output would be great

@cuipengfei commented on GitHub (Feb 1, 2026): Having a settings option to control how many lines are shown of the mcp tool call output would be great
Author
Owner

@yanosh-k commented on GitHub (Feb 3, 2026):

It could check the config for such a setting and set the number of shown lines based on it.

In the PR I've also added (per Aiden Cline's request) a menu option to toggle the output on and off, so probably the minimum number of lines should be 1, as setting it to 0 would be equivalent to turning the option off.

So when checking the setting it should be something like const maxLines = Math.max(1, ctx.sync.data.config.tui?.generic_tool_preview_lines).

@yanosh-k commented on GitHub (Feb 3, 2026): It could check the config for such a setting and set the number of shown lines based on it. In the PR I've also added (per Aiden Cline's request) a menu option to toggle the output on and off, so probably the minimum number of lines should be 1, as setting it to 0 would be equivalent to turning the option off. So when checking the setting it should be something like `const maxLines = Math.max(1, ctx.sync.data.config.tui?.generic_tool_preview_lines)`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4067