Skip to content

Fix dry-run MCP argument validation#21

Open
sozercan wants to merge 1 commit intomainfrom
fix/dry-run-validation-mcp-args
Open

Fix dry-run MCP argument validation#21
sozercan wants to merge 1 commit intomainfrom
fix/dry-run-validation-mcp-args

Conversation

@sozercan
Copy link
Copy Markdown
Owner

@sozercan sozercan commented May 8, 2026

Summary

  • add explicit MCP args support to dry-run validation while preserving safe display data
  • route mutating command dry-runs and real execution through the same MCP args source
  • add shared command execution helpers and MCP recorder test utilities
  • cover explicit dry-run validation behavior and representative command integrations with tests

Validation

  • git diff --check
  • go test ./... -count=1
  • go vet ./...
  • golangci-lint run ./...

Copilot AI review requested due to automatic review settings May 8, 2026 07:31
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes dry-run MCP argument validation by allowing commands to validate the actual MCP tool arguments (including required-but-not-displayed fields), while keeping dry-run output limited to safe display metadata. It also introduces a shared execution layer to reduce drift between dry-run and real execution paths.

Changes:

  • Update many command handlers to build a single args map and pass it both to ValidateDryRun(..., display, args) and CallTool(..., args).
  • Add internal/commands/exec to centralize MCP query/mutation execution + output rendering (used by several commands like mail/calendar/sharepoint).
  • Add MCP test recorder utilities and expand tests to cover explicit dry-run validation and executor behavior.
Show a summary per file
File Description
internal/testutil/testutil.go Adds MCP call recorder + refactors test server setup to support recording and schemas.
internal/commands/word/word.go Reuses a single MCP args map for dry-run validation and execution.
internal/commands/triggers/triggers.go Aligns dry-run validation args with execution args for trigger mutations.
internal/commands/teams/chats.go Aligns dry-run validation args with execution args for chat mutations.
internal/commands/teams/channels.go Aligns dry-run validation args with execution args for channel mutations.
internal/commands/splists/splists.go Aligns args; routes one mutation through the new shared executor.
internal/commands/splists/splists_test.go Adds test ensuring dry-run validates actual MCP args for list-item update.
internal/commands/sharepoint/sharepoint.go Aligns args; routes some mutations through the new shared executor.
internal/commands/sharepoint/sharepoint_test.go Adds test ensuring dry-run validates selected tool + actual args for binary writes.
internal/commands/root_test.go Adds test proving ValidateDryRun uses explicit MCP args while preserving display-only output.
internal/commands/planner/planner.go Aligns dry-run validation args with execution args across planner commands.
internal/commands/onedriveremote/onedriveremote.go Aligns dry-run validation args with execution args across OneDrive Remote commands.
internal/commands/mail/mail.go Moves selected commands to shared executor; aligns dry-run validation args for several mutations.
internal/commands/mail/mail_test.go Adds test ensuring dry-run validates actual args for message update.
internal/commands/knowledge/knowledge.go Aligns dry-run validation args with execution args for knowledge mutations.
internal/commands/exec/exec.go New shared MCP executor for queries/mutations (dry-run validation, confirmation, rendering).
internal/commands/exec/exec_test.go Tests executor query rendering, dry-run mutation behavior, and destructive confirmation behavior.
internal/commands/excel/excel.go Reuses a single MCP args map for dry-run validation and execution.
internal/commands/calendar/calendar.go Moves update mutation to executor; aligns dry-run validation args with execution args elsewhere.
internal/commands/calendar/calendar_test.go Adds test ensuring dry-run validates actual args for calendar update.
internal/commands/admin365/admin365.go Aligns dry-run validation args with execution args for several admin365 mutations.
internal/commands/admin/admin.go Aligns dry-run validation args with execution args for license updates.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 22/22 changed files
  • Comments generated: 2

Comment on lines 48 to 49
"action": "admin365.bulk-add",
"fileContent": c.FileContent,
@@ -222,6 +228,7 @@ func (c *ODRWriteCmd) Run(ctx *commands.Context) error {
"filename": c.Filename,
"contentText": c.ContentText,
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.

2 participants