sqlmc_list_coverage: It asks before it connects

This is the part an agent author must get right.

Last updated 2026-10-21

This is the part an agent author must get right.

A coverage call against a group with production databases: nothing is scanned, the production targets are named and a confirmation token is returned.
A coverage call against a group with production databases: nothing is scanned, the production targets are named and a confirmation token is returned.

Call it without confirmationToken. It connects to nothing and returns the plan:

{
  "ok": true, "errors": [],
  "listName": "All Prod",
  "confirmationRequired": true,
  "confirmationToken": "a41f…",
  "targetCount": 12,
  "alreadyCached": 9,
  "productionTargets": [
    { "connection": "sql-prod-01", "database": "Sales", "isProduction": true }
  ],
  "scanned": 0, "failed": 0, "cancelled": false, "findings": []
}

Call again with that token to run it.

The token is derived from the plan, so it stops matching the moment the group's membership changes. The caller is then handed a fresh plan rather than quietly reading a database it never agreed to. Comparison is ordinal: a token echoed back differing by case is a token that did not come from here.