Repository navigation
Render MCP command results in the interactive shell - #302
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
MCP calls still fail to return plain-text results under a CSV session default, and some command failures display duplicate diagnostics.
2 open issues
What changed in this PR
This PR routes completed MCP commands through the shell’s normal output path so terminal users can see results, warnings, and errors alongside echoed commands.
Changes:
- Render results using explicit or session-default formats while retaining structured MCP responses.
- Keep rendering inside serialized execution and refresh the prompt after success or failure.
- Document terminal behavior and add format, error, warning, and HTTP transport regression coverage.
| File | Description |
|---|---|
docs/mcp.md |
Documents terminal results and format selection for MCP calls. |
CosmosDBShell/Azure.Data.Cosmos.Shell.Mcp/ToolOperations.cs |
Renders completed commands and refreshes the prompt in cleanup. |
CosmosDBShell/Azure.Data.Cosmos.Shell.Core/ShellInterpreter.cs |
Adds shared command-result and error rendering. |
CosmosDBShell.Tests/ToolOperationsCallToolTests.cs |
Adds rendering parity, format, warning, and failure coverage. |
CosmosDBShell.Tests/McpLocationSubscriptionTests.cs |
Checks terminal output through Streamable HTTP and legacy SSE. |
Review effort: Balanced
Code coverage overviewLanguages: C# C# / code-coverage/dotnet
View coverage of the 8 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
Avoid duplicate diagnostics for already-reported command failures and preserve plain-text MCP results under CSV session defaults. Add regression coverage and simplify output assertions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Addressed all eight review threads in d203314: prevented duplicate diagnostics from theme/help failures, preserved plain-text MCP responses with CSV defaults from both --output and COSMOSDB_SHELL_FORMAT, and consolidated the flagged output assertions. Added regression tests and updated the MCP outputText documentation. Validation: 224 focused tests passed; shell and test builds passed with zero warnings/errors; git diff --check passed. |
There was a problem hiding this comment.
🟡 Changes recommended
Unconditional rendered flags suppress structured JSON error output for failed theme commands and unknown help topics, breaking machine-mode diagnostics and stderr redirection.
2 open issues
2 resolved since last review
Review effort: Balanced
Avoid duplicate diagnostics for already-reported command failures and preserve plain-text MCP results under CSV session defaults. Add regression coverage and simplify output assertions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve theme/help conflicts using shared error reporting and extend MCP coverage for user, JSON, CSV, and redirected errors. Align command echo expectations and documentation with the centralized output policy. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because real-host command failures can produce duplicate terminal diagnostics through overlapping error-rendering and logging paths.
No open issues 🎉
3 resolved since last review
Review effort: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Render MCP command results in the interactive shell Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> (cherry picked from commit 7e8db53) * Fix MCP result rendering review issues (#302) Avoid duplicate diagnostics for already-reported command failures and preserve plain-text MCP results under CSV session defaults. Add regression coverage and simplify output assertions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Preserve machine-mode error diagnostics (#303) Only mark help and theme errors as rendered when their human-facing diagnostics are visible. Cover unknown help topics in machine output and stderr redirection tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Summary
MCP-generated commands currently appear in the terminal without their results. Render each completed tool invocation through the normal shell output path, as if the user had typed the command.
user,json,csv, ortable) or the current session default.Validation
git diff --checkpassed.Compatibility
MCP response envelopes, confirmation requirements, and paging semantics remain unchanged. The intended behavior change is visible terminal output after MCP-generated commands. No migration steps are required.
Backport
Backport to
rel/1.2: #303. Merge this PR first, then the backport.