Skip to main content
Glama
oldcoder01
by oldcoder01

collect_snapshot

Capture a comprehensive inventory of AWS resources and configurations for security assessment, operational checks, and cost analysis.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scopeYes
authNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The @mcp.tool decorated handler function that implements the collect_snapshot tool. It collects AWS resource data (EC2, ELBv2, RDS, S3, CloudTrail, CloudWatch) across specified or all enabled regions, computes summaries, saves the snapshot, and returns snapshot_id, regions, and summary.
    @mcp.tool
    def collect_snapshot(scope: Dict[str, Any], auth: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        session = build_boto3_session(auth)
        sid = _snapshot_id()
    
        who = aws_whoami(auth=auth)
        requested = scope.get("regions")
        if scope.get("all") is True or requested is None:
            regions = list_enabled_regions(session)
        else:
            regions = list(requested)
    
        ec2_by_region: Dict[str, Any] = {}
        elbv2_by_region: Dict[str, Any] = {}
        rds_by_region: Dict[str, Any] = {}
        telemetry_cloudwatch: List[Dict[str, Any]] = []
    
        # collectors (MVP: sequential; add concurrency later)
        for r in regions:
            ec2_by_region[r] = collect_ec2_region(session, r)
            elbv2_by_region[r] = collect_elbv2_region(session, r)
            rds_by_region[r] = collect_rds_region(session, r)
            telemetry_cloudwatch.append(collect_cloudwatch_alarm_count(session, r))
    
        # global-ish collectors
        s3_blob = collect_s3(session)
        # CloudTrail: use caller region or us-east-1; trails are global objects but API is regional
        ct_region = session.region_name or "us-east-1"
        cloudtrail_blob = collect_cloudtrail(session, ct_region)
    
        total_alarm_count = 0
        alarm_count_known = True
        for row in telemetry_cloudwatch:
            if row.get("alarm_count") is None:
                alarm_count_known = False
            else:
                total_alarm_count += int(row.get("alarm_count"))
    
        summary = {
            "ec2_instances": sum(len(v.get("instances", [])) for v in ec2_by_region.values()),
            "security_groups": sum(len(v.get("security_groups", [])) for v in ec2_by_region.values()),
            "ebs_volumes": sum(len(v.get("volumes", [])) for v in ec2_by_region.values()),
            "elastic_ips": sum(len(v.get("eips", [])) for v in ec2_by_region.values()),
            "elbv2_load_balancers": sum(len(v.get("load_balancers", [])) for v in elbv2_by_region.values()),
            "elbv2_target_groups": sum(len(v.get("target_groups", [])) for v in elbv2_by_region.values()),
            "rds_instances": sum(len(v.get("instances", [])) for v in rds_by_region.values()),
            "rds_clusters": sum(len(v.get("clusters", [])) for v in rds_by_region.values()),
            "s3_buckets": len(s3_blob.get("buckets", [])),
        }
    
        snapshot: Dict[str, Any] = {
            "meta": {
                "snapshot_id": sid,
                "account_id": who.get("account"),
                "collected_at": now_iso_utc(),
                "regions": regions,
            },
            "summary": summary,
            "ec2_by_region": ec2_by_region,
            "elbv2_by_region": elbv2_by_region,
            "rds_by_region": rds_by_region,
            "s3": s3_blob,
            "telemetry": {
                "cloudtrail": cloudtrail_blob,
                "cloudwatch_alarms": {
                    "by_region": telemetry_cloudwatch,
                    "total_alarm_count": total_alarm_count if alarm_count_known else None,
                },
            },
        }
    
        save_snapshot(DATA_DIR, sid, snapshot)
        return {"snapshot_id": sid, "regions": regions, "summary": summary}
  • The @mcp.tool decorator registers the collect_snapshot function as an MCP tool.
    @mcp.tool
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Tool has no description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/oldcoder01/aws-mcp-audit'

If you have feedback or need assistance with the MCP directory API, please join our Discord server