Skip to content

MCP tools and prompts ​

tfcensus mcp serves these tools and prompts over stdio. This page comes from the server's own tools/list and prompts/list answers. See tfcensus mcp for the flags.

Server instructions ​

The server sends this text to the client when it connects:

text
tfcensus answers questions about a Terraform/OpenTofu and Terragrunt fleet on AWS from reports that earlier tfcensus runs saved: which units exist, what they manage, which states manage an ARN or ID (whois), what is unmanaged (scan_summary), backend audit findings and drift. The tools never call AWS, run terraform or terragrunt, or write anything, so answers are only as fresh as the saved files; check source.created and the warnings. Every result is the JSON envelope of tfcensus report or whois --index with --format json. When the envelope has page.next_cursor, call the same tool with only that cursor to get the rest.

Tools ​

audit_findings ​

Backend audit findings. Read-only.

Lists the state backend audit findings of the saved audit JSON, highest severity first.

Input schema:

json
{
  "additionalProperties": false,
  "properties": {
    "account": {
      "description": "AWS account ID.",
      "type": "string"
    },
    "cursor": {
      "description": "The next_cursor of an earlier result of this tool. Other arguments are then ignored.",
      "type": "string"
    },
    "include_suppressed": {
      "description": "List suppressed findings too, with their suppression reason.",
      "type": "boolean"
    },
    "rule": {
      "description": "Check ID glob, such as S3-* or LK-STALE.",
      "type": "string"
    },
    "severity": {
      "description": "Lowest severity to list: info, low, medium or high.",
      "type": "string"
    }
  },
  "type": "object"
}

drift_summary ​

Drift summary. Read-only.

Lists drifted and failed units and their drifted resources with attribute paths from the saved drift JSON; it runs no plan.

Input schema:

json
{
  "additionalProperties": false,
  "properties": {
    "cursor": {
      "description": "The next_cursor of an earlier result of this tool. Other arguments are then ignored.",
      "type": "string"
    },
    "status": {
      "description": "Unit status: drifted, failed, clean, early-exit or excluded. Default: drifted and failed.",
      "type": "string"
    },
    "unit": {
      "description": "Unit path glob; * also matches /.",
      "type": "string"
    }
  },
  "type": "object"
}

inventory ​

Inventory per unit. Read-only.

Counts the managed resource instances in the saved state index per unit and TF type, with double-managed counts.

Input schema:

json
{
  "additionalProperties": false,
  "properties": {
    "account": {
      "description": "AWS account ID.",
      "type": "string"
    },
    "cursor": {
      "description": "The next_cursor of an earlier result of this tool. Other arguments are then ignored.",
      "type": "string"
    },
    "region": {
      "description": "AWS region, such as eu-west-1.",
      "type": "string"
    },
    "type": {
      "description": "TF resource type glob, such as aws_iam_*.",
      "type": "string"
    },
    "unit": {
      "description": "Unit path glob; * also matches /.",
      "type": "string"
    }
  },
  "type": "object"
}

scan_summary ​

Scan summary. Read-only.

Gives per-account category counts and coverage of the last scan, counts per resource type, and its top double-managed and unmanaged resources, from the saved scan JSON or the newest scan cache snapshot.

Input schema:

json
{
  "additionalProperties": false,
  "properties": {
    "account": {
      "description": "AWS account ID.",
      "type": "string"
    },
    "category": {
      "description": "List this category instead of double-managed and unmanaged: managed, double-managed, unmanaged, other-iac, aws-managed, derived, ignored or undetermined.",
      "type": "string"
    },
    "cursor": {
      "description": "The next_cursor of an earlier result of this tool. Other arguments are then ignored.",
      "type": "string"
    },
    "region": {
      "description": "AWS region, or global. Counts are then per region.",
      "type": "string"
    },
    "top": {
      "description": "Findings to list, 1 to 500. Default 50.",
      "type": "integer"
    },
    "type": {
      "description": "CloudFormation or layer type glob, such as AWS::EC2::*.",
      "type": "string"
    }
  },
  "type": "object"
}

units ​

Units. Read-only.

Lists the units and workspaces in the saved state index, with state status, instance count, accounts and regions.

Input schema:

json
{
  "additionalProperties": false,
  "properties": {
    "cursor": {
      "description": "The next_cursor of an earlier result of this tool. Other arguments are then ignored.",
      "type": "string"
    },
    "path": {
      "description": "Unit path glob; * also matches /, such as acme-live/prod/*.",
      "type": "string"
    },
    "status": {
      "description": "State status: ok, absent, encrypted, unsupported or error.",
      "type": "string"
    }
  },
  "type": "object"
}

whois ​

Who manages a resource. Read-only.

Finds which units and addresses manage each ARN or TF resource ID in the saved state index, or which ownership rule explains an unmanaged one.

Input schema:

json
{
  "additionalProperties": false,
  "properties": {
    "queries": {
      "description": "ARNs or TF resource IDs, such as arn:aws:s3:::acme-assets or sg-0123456789abcdef0.",
      "items": {
        "type": "string"
      },
      "type": [
        "null",
        "array"
      ]
    },
    "types": {
      "description": "TF resource types to look in, such as aws_security_group. Default: the type the ARN maps to, else every type.",
      "items": {
        "type": "string"
      },
      "type": [
        "null",
        "array"
      ]
    }
  },
  "required": [
    "queries"
  ],
  "type": "object"
}

Prompts ​

explain_unmanaged ​

Explain unmanaged resources.

Explains the unmanaged resources of the last scan by rule and proposes import, an ownership rule or a deletion review for each group, citing rule IDs and ARNs.

ArgumentRequiredDescription
accountnoAWS account ID. Default: every account.
typenoCloudFormation or layer type glob, such as AWS::EC2::*. Default: every type.

triage_drift ​

Triage drift.

Sorts the drifted and failed units of the saved drift report into revert, adopt and investigate, citing unit paths, resource addresses and attribute paths.

ArgumentRequiredDescription
unitnoUnit path glob to triage; * also matches /. Default: every unit.