Skip to content

Show a command preview when a confirm-gated tool is called without confirm #119

Closed

Description

@TMHSDigital

Summary

When a confirm-gated tool is called with confirm: false it only answers "cancelled. Set confirm=true to proceed." The only way to see what a state-changing tool would run is the process-wide HOMELAB_DRY_RUN, which needs a server restart and affects every tool.

Where

  • mcp-server/src/utils/confirm-param.ts:15 (confirmCancelled)
  • mcp-server/src/utils/ssh-api.ts:212, :279 (global dry run)

Proposal

With confirm: false, return a preview: target node and host plus the command that would run (compose files and action, restore snapshot and target, filter URL and new state, and so on). Reuse the dry-run path so the command guard and node lookup still run. Mask any credentials in the preview text.

Who benefits

Users approving composeDown, backupRestore, nodeExec or piReboot through an agent. The agent can show exactly what will happen before asking for confirm: true, which turns the confirm step into an informed decision.

Open questions

  • Whether confirm should become optional (absent = preview) or stay required.

Acceptance criteria

  • Every gated tool returns a preview when confirm is false.
  • confirm-gates.test.ts asserts the preview and that nothing was executed.

Getting started

  • Relevant files: mcp-server/src/utils/confirm-param.ts, mcp-server/src/tools/__tests__/confirm-gates.test.ts

Filed by repo-audit/full-audit at a59395f. Severity: medium. Effort: M. audit-key: enhancement|mcp-server/src/utils/confirm-param.ts|preview

Activity

  1. added
    enhancement
    help wanted
    severity: medium
    on Nov 18, 2026
  2. TMHSDigital commented on Nov 18, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in f1dd197. With confirm: false, all eleven gated tools now return a preview: target node (user@host[:port]), the command(s) they would run with credentials masked, whether the command guard would block them, argument errors, and notes for extra steps. Nothing is executed. confirm stays required (open question resolved conservatively). Verified in confirm-gates.test.ts: each gated tool previews its real command with execSSH never called, plus masking, guard and invalid-argument cases (391 tests passing).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhelp wantedmcp-serverseverity: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions