[FEATURE]: Display MCP Tool Parameters in Permission Dialog #8510

Open
opened 2026-02-16 18:10:09 -05:00 by yindo · 1 comment
Owner

Originally created by @broboa on GitHub (Feb 4, 2026).

Originally assigned to: @thdxr 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

Problem

When MCP tools are invoked (e.g., memory_create_entities, memory_add_observations), the permission dialog only displays the tool name without showing the actual parameters being passed. This makes it difficult to understand what the tool will do and whether to approve the action.

Current behavior:

Call tool memory_create_entities

Expected behavior:

Call tool memory_create_entities
entities: [
  {
    name: "OpenCode",
    entityType: "project",
    observations: ["Uses Bun monorepo structure"]
  }
]

Current Implementation

The permission prompt component (packages/opencode/src/cli/cmd/tui/routes/session/permission.tsx) has explicit display logic for built-in tools:

  • read - shows file path
  • glob - shows pattern
  • grep - shows pattern
  • bash - shows description and command
  • task - shows subagent type and description
  • webfetch - shows URL

MCP tools fall through to a generic fallback case (line 262-264):

<Match when={true}>
  <TextBody icon="⚙" title={`Call tool ` + props.request.permission} />
</Match>

The input() memo (lines 128-138) already contains the tool parameters but isn't rendered in this fallback case.

Proposed Solution

Configuration Options

Add configuration to control parameter visibility:

{
  "tui": {
    "mcp_show_parameters": "all" | "none" | "selected",
    "mcp_show_parameters_tools": ["memory_create_entities", "memory_add_observations"]
  }
}

Configuration modes:

  • all - Show parameters for all MCP tools (default for transparency)
  • none - Hide parameters for all MCP tools (minimal UI)
  • selected - Show parameters only for tools listed in mcp_show_parameters_tools

Implementation Approach

Modify the fallback case to conditionally display tool parameters based on config:

<Match when={true}>
  {(() => {
    const shouldShowParams = (() => {
      const mode = sync.data.config.tui?.mcp_show_parameters ?? "all"
      if (mode === "none") return false
      if (mode === "all") return true
      const allowedTools = sync.data.config.tui?.mcp_show_parameters_tools ?? []
      return allowedTools.includes(props.request.permission)
    })()
    
    const params = shouldShowParams && Object.keys(input()).length > 0
      ? JSON.stringify(input(), null, 2)
      : undefined
    
    return (
      <TextBody 
        icon="⚙" 
        title={`Call tool ` + props.request.permission}
        description={params}
      />
    )
  })()}
</Match>

Display Options

For parameter rendering:

  1. Formatted JSON view - Display parameters as indented JSON
  2. Key-value list - Show each parameter as a labeled field
  3. Smart truncation - Show first N characters with expand option for large payloads

Impact

  • Improves transparency when using MCP tools
  • Allows users to make informed permission decisions
  • Maintains consistency with how built-in tools display their parameters
  • Critical for security-sensitive operations like knowledge graph modifications

Additional Context

This affects all MCP server tools, not just memory operations. Any custom MCP tool will have this limitation.

Originally created by @broboa on GitHub (Feb 4, 2026). Originally assigned to: @thdxr 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 ## Problem When MCP tools are invoked (e.g., `memory_create_entities`, `memory_add_observations`), the permission dialog only displays the tool name without showing the actual parameters being passed. This makes it difficult to understand what the tool will do and whether to approve the action. **Current behavior:** ``` Call tool memory_create_entities ``` **Expected behavior:** ``` Call tool memory_create_entities entities: [ { name: "OpenCode", entityType: "project", observations: ["Uses Bun monorepo structure"] } ] ``` ## Current Implementation The permission prompt component (`packages/opencode/src/cli/cmd/tui/routes/session/permission.tsx`) has explicit display logic for built-in tools: - `read` - shows file path - `glob` - shows pattern - `grep` - shows pattern - `bash` - shows description and command - `task` - shows subagent type and description - `webfetch` - shows URL MCP tools fall through to a generic fallback case (line 262-264): ```tsx <Match when={true}> <TextBody icon="⚙" title={`Call tool ` + props.request.permission} /> </Match> ``` The `input()` memo (lines 128-138) already contains the tool parameters but isn't rendered in this fallback case. ## Proposed Solution ### Configuration Options Add configuration to control parameter visibility: ```json { "tui": { "mcp_show_parameters": "all" | "none" | "selected", "mcp_show_parameters_tools": ["memory_create_entities", "memory_add_observations"] } } ``` **Configuration modes:** - `all` - Show parameters for all MCP tools (default for transparency) - `none` - Hide parameters for all MCP tools (minimal UI) - `selected` - Show parameters only for tools listed in `mcp_show_parameters_tools` ### Implementation Approach Modify the fallback case to conditionally display tool parameters based on config: ```tsx <Match when={true}> {(() => { const shouldShowParams = (() => { const mode = sync.data.config.tui?.mcp_show_parameters ?? "all" if (mode === "none") return false if (mode === "all") return true const allowedTools = sync.data.config.tui?.mcp_show_parameters_tools ?? [] return allowedTools.includes(props.request.permission) })() const params = shouldShowParams && Object.keys(input()).length > 0 ? JSON.stringify(input(), null, 2) : undefined return ( <TextBody icon="⚙" title={`Call tool ` + props.request.permission} description={params} /> ) })()} </Match> ``` ### Display Options For parameter rendering: 1. **Formatted JSON view** - Display parameters as indented JSON 2. **Key-value list** - Show each parameter as a labeled field 3. **Smart truncation** - Show first N characters with expand option for large payloads ## Impact - Improves transparency when using MCP tools - Allows users to make informed permission decisions - Maintains consistency with how built-in tools display their parameters - Critical for security-sensitive operations like knowledge graph modifications ## Additional Context This affects all MCP server tools, not just memory operations. Any custom MCP tool will have this limitation.
yindo added the discussion label 2026-02-16 18:10:09 -05:00
Author
Owner

@broboa commented on GitHub (Feb 4, 2026):

Related https://github.com/anomalyco/opencode/issues/6604

@broboa commented on GitHub (Feb 4, 2026): Related https://github.com/anomalyco/opencode/issues/6604
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8510