Skip to content

Commit 7966fc1

Browse files
Copilotpelikhan
andauthored
Migrate MCP list/inspect table output to explicit console.RenderTable() with stdout routing (#23752)
* Initial plan * Migrate MCP list/inspect to use console.RenderTable() with explicit stdout routing Agent-Logs-Url: https://github.com/github/gh-aw/sessions/c8367fa1-6052-4568-b4ee-57065ccab844 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent a30e9ff commit 7966fc1

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

pkg/cli/mcp_inspect_mcp.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,8 @@ func displayServerCapabilities(info *parser.MCPServerInfo, toolFilter string) {
359359
ShowVerboseHint: false,
360360
}
361361

362-
// Render the table using the shared helper
363-
table := renderMCPToolTable(info, opts)
364-
fmt.Print(table)
362+
// Render the table using the shared helper and print to stdout (structured data)
363+
fmt.Fprint(os.Stdout, renderMCPToolTable(info, opts))
365364

366365
// Add helpful hint about how to allow tools in workflow frontmatter
367366
displayToolAllowanceHint(info)
@@ -396,11 +395,10 @@ func displayServerCapabilities(info *parser.MCPServerInfo, toolFilter string) {
396395
rows = append(rows, []string{resource.URI, resource.Name, description, mimeType})
397396
}
398397

399-
table := console.RenderTable(console.TableConfig{
398+
fmt.Fprint(os.Stdout, console.RenderTable(console.TableConfig{
400399
Headers: headers,
401400
Rows: rows,
402-
})
403-
fmt.Print(table)
401+
}))
404402
} else if toolFilter == "" {
405403
fmt.Fprintf(os.Stderr, "\n%s\n", console.FormatWarningMessage("No resources available"))
406404
}
@@ -416,11 +414,10 @@ func displayServerCapabilities(info *parser.MCPServerInfo, toolFilter string) {
416414
rows = append(rows, []string{root.URI, root.Name})
417415
}
418416

419-
table := console.RenderTable(console.TableConfig{
417+
fmt.Fprint(os.Stdout, console.RenderTable(console.TableConfig{
420418
Headers: headers,
421419
Rows: rows,
422-
})
423-
fmt.Print(table)
420+
}))
424421
} else if toolFilter == "" {
425422
fmt.Fprintf(os.Stderr, "\n%s\n", console.FormatWarningMessage("No roots available"))
426423
}

pkg/cli/mcp_list_tools.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,8 @@ func displayToolsList(info *parser.MCPServerInfo, verbose bool) {
161161
opts.ShowVerboseHint = true
162162
}
163163

164-
// Render the table using the shared helper
165-
table := renderMCPToolTable(info, opts)
166-
fmt.Print(table)
164+
// Render the table using the shared helper and print to stdout (structured data)
165+
fmt.Fprint(os.Stdout, renderMCPToolTable(info, opts))
167166
}
168167

169168
// NewMCPListToolsSubcommand creates the mcp list-tools subcommand

0 commit comments

Comments
 (0)