Skip to content

Mark canister create/top-up as destructive: they spend user funds - #117

Merged
aterga merged 1 commit into
mainfrom
claude/destructive-hints-p4el4n
Aug 3, 2026
Merged

aterga merged 1 commit into
mainfrom
claude/destructive-hints-p4el4n

Conversation

@aterga

@aterga aterga commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

icp_create_canister and icp_top_up_canister were annotated destructiveHint: false, grouped with start/stop as "additive/reversible" writes: they add a canister, or add cycles to one. That reads the wrong axis. Both spend the user's cycles or ICP: the funds leave the user's cycles-ledger or ICP-ledger account irreversibly, nothing in this tool surface can claw them back, and neither call is idempotent — a retry spends again (the ICP path is explicitly best-effort, single-attempt).

destructiveHint is what a directory client gates its confirmation prompt on, and the MCP spec's default for the hint is true — so declaring false was an affirmative promise that a stray call costs the user nothing. This matters directly for the directory submissions: both portals scan the descriptor, and an "incorrect action label" is a named rejection cause. Fixing it in the source (rather than overriding in a portal) keeps the listed server, the scan, and the review answers consistent.

Start/stop stay non-destructive: they change run state only, cost nothing, and each is undone by its counterpart.

Related issues

Follows #116 (consent-screen terminology) in the pre-submission cleanup series; supports the directory submissions prepared in #109 and #115.

Changes

  • src/tools.rs:
    • icp_create_canister and icp_top_up_canister: destructive_hint = false → true, with a comment recording the reasoning at each annotation.
    • Both descriptions now open with a "SPENDS FUNDS: this draws cycles or ICP from your accounts and cannot be automatically reversed, so confirm with the user before calling it" warning, so the model is told to confirm even through clients that ignore annotations.
    • The annotation unit test moves both tools into the destructive group and documents the two kinds of destructive tools (state-overwriting vs fund-spending), so a future "these are additive" simplification fails with the rationale in view.

Testing

  • cargo build --locked --all-targets — no new warnings
  • cargo test --locked --all-targets — 151 lib + 2 bin + 8 router tests pass (including the updated annotation test), re-run after rebasing onto main with Use Internet Identity's access-level wording in the runtime messages #116
  • cargo fmt --all / cargo clippy --all-targets — not run: the toolchain here reformats ~380 untouched files, which would bury the change
  • npm test --prefix monitoring/mcp-status — n/a, dashboard unchanged

Checklist

  • I have read the Contributing guidelines.
  • Docs (README / comments) updated for any user-visible change — the README does not enumerate per-tool hints; the "17 read-only tools" counts in the submission guides are unaffected (the read-only set is unchanged).
  • No secrets, credentials, or internal-only information are included.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TGhwpdTbUqQbR5AiiN8Ljw


Generated by Claude Code

icp_create_canister and icp_top_up_canister were annotated
destructive_hint = false as "additive" writes: they add a canister or
add cycles to one. That reads the wrong axis. Both spend the user's
cycles or ICP — the funds leave the user's ledger accounts irreversibly,
nothing in this tool surface can claw them back, and neither call is
idempotent, so a client retry spends again. destructiveHint is what a
client gates its confirmation prompt on, and its spec default is true:
declaring false was an affirmative promise that a stray call costs the
user nothing.

Both are now destructive_hint = true, their descriptions open with a
SPENDS-FUNDS warning telling the model to confirm with the user first,
and the annotation test moves them into the destructive group with the
reasoning recorded so they are not "corrected" back to additive later.
Start/stop stay non-destructive: they change run state only, cost
nothing, and each is undone by its counterpart.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TGhwpdTbUqQbR5AiiN8Ljw
@aterga
aterga requested a review from Copilot August 3, 2026 12:53
@aterga
aterga marked this pull request as ready for review August 3, 2026 12:53
@aterga
aterga requested a review from a team August 3, 2026 12:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Marks canister creation and top-ups as destructive because they irreversibly spend user funds.

Changes:

  • Adds explicit fund-spending warnings to both tool descriptions.
  • Sets destructive_hint = true.
  • Updates annotation tests and rationale.

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

@aterga
aterga merged commit c6b77b4 into main Aug 3, 2026
8 checks passed
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.

4 participants