diff --git a/pkg/cli/mcp_inspect_mcp.go b/pkg/cli/mcp_inspect_mcp.go index 6f41f7a80f8..33f46a61050 100644 --- a/pkg/cli/mcp_inspect_mcp.go +++ b/pkg/cli/mcp_inspect_mcp.go @@ -359,9 +359,8 @@ func displayServerCapabilities(info *parser.MCPServerInfo, toolFilter string) { ShowVerboseHint: false, } - // Render the table using the shared helper - table := renderMCPToolTable(info, opts) - fmt.Print(table) + // Render the table using the shared helper and print to stdout (structured data) + fmt.Fprint(os.Stdout, renderMCPToolTable(info, opts)) // Add helpful hint about how to allow tools in workflow frontmatter displayToolAllowanceHint(info) @@ -396,11 +395,10 @@ func displayServerCapabilities(info *parser.MCPServerInfo, toolFilter string) { rows = append(rows, []string{resource.URI, resource.Name, description, mimeType}) } - table := console.RenderTable(console.TableConfig{ + fmt.Fprint(os.Stdout, console.RenderTable(console.TableConfig{ Headers: headers, Rows: rows, - }) - fmt.Print(table) + })) } else if toolFilter == "" { fmt.Fprintf(os.Stderr, "\n%s\n", console.FormatWarningMessage("No resources available")) } @@ -416,11 +414,10 @@ func displayServerCapabilities(info *parser.MCPServerInfo, toolFilter string) { rows = append(rows, []string{root.URI, root.Name}) } - table := console.RenderTable(console.TableConfig{ + fmt.Fprint(os.Stdout, console.RenderTable(console.TableConfig{ Headers: headers, Rows: rows, - }) - fmt.Print(table) + })) } else if toolFilter == "" { fmt.Fprintf(os.Stderr, "\n%s\n", console.FormatWarningMessage("No roots available")) } diff --git a/pkg/cli/mcp_list_tools.go b/pkg/cli/mcp_list_tools.go index d9ddf782fd8..06005c2a9f3 100644 --- a/pkg/cli/mcp_list_tools.go +++ b/pkg/cli/mcp_list_tools.go @@ -161,9 +161,8 @@ func displayToolsList(info *parser.MCPServerInfo, verbose bool) { opts.ShowVerboseHint = true } - // Render the table using the shared helper - table := renderMCPToolTable(info, opts) - fmt.Print(table) + // Render the table using the shared helper and print to stdout (structured data) + fmt.Fprint(os.Stdout, renderMCPToolTable(info, opts)) } // NewMCPListToolsSubcommand creates the mcp list-tools subcommand