Skip to content

Avoid a second console prompt after MCP deletion approval - #316

Open
Mike Krüger (mkrueger) wants to merge 1 commit into
mainfrom
dev/mkrueger/fix/311-mcp-deletion-confirmation
Open

Mike Krüger (mkrueger) wants to merge 1 commit into
mainfrom
dev/mkrueger/fix/311-mcp-deletion-confirmation

Conversation

@mkrueger

Copy link
Copy Markdown
Collaborator

Fixes #311.

Summary

  • Run rmcon and rmdb without a second terminal prompt after MCP approval and shell-context revalidation. Approval is scoped to the exact invocation.
  • Preserve direct-shell confirmation and refuse missing or declined MCP approval even when force is set.
  • Update the MCP documentation and add HTTP regression tests with a mocked Cosmos backend.

Validation

  • Reproduced the headless failure for both commands before the fix.
  • All 546 targeted tests passed after the fix; all 12 focused approval and context tests passed on review.
  • No live Cosmos resources were used.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the change that removes redundant terminal prompts from MCP-approved deletions.

No open issues 🎉

What changed in this PR

Addresses #311 by allowing MCP-approved database and container deletions to proceed without a second terminal prompt, including on headless servers.

Changes:

  • Bind MCP approval to the exact command instance and clear it after execution.
  • Skip the terminal prompt for approved rmcon and rmdb calls while preserving direct-shell confirmation and the MCP approval gate.
  • Add mocked HTTP regression tests for accepted, declined, and missing approval, and document the behavior.
File Description
docs/​mcp.md Document single-prompt MCP deletion behavior.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Mcp/​ToolOperations.cs Set invocation-scoped approval and clear it in finally.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Core/​CommandState.cs Store the exact command instance approved through MCP.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Commands/​RmDbCommand.cs Honor MCP approval without another database deletion prompt.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Commands/​RmContainerCommand.cs Honor MCP approval without another container deletion prompt.
CosmosDBShell.Tests/​McpConfirmationTests.cs Cover HTTP deletion approval and refusal paths with a mocked Cosmos backend.

Review effort: Balanced

@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: C#

C# / code-coverage/dotnet

main 3628267 dev/mkrueger/fix/311... bbba61f +/-
76% 76% 0%
View coverage of the 8 most impacted files.
File main 3628267 dev/mkrueger/fix/311... bbba61f +/-
D:\a\CosmosDBSh...olOperations.cs 95% 95% 0%
D:\a\CosmosDBSh...CommandState.cs 95% 95% 0%
D:\a\CosmosDBSh...osmosCommand.cs 80% 81% +1%
D:\a\CosmosDBSh...ceOperations.cs 51% 57% +6%
D:\a\CosmosDBSh...sourceFacade.cs 65% 77% +12%
D:\a\CosmosDBSh...til\ExitCode.cs 50% 67% +17%
D:\a\CosmosDBSh...ainerCommand.cs 24% 68% +44%
D:\a\CosmosDBSh...\RmDbCommand.cs 28% 73% +45%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid a second console prompt after MCP deletion approval

2 participants