Skip to main content
Glama

list_snapshots

Retrieve a list of disk snapshots within a specified Google Cloud Platform (GCP) project to manage and review backup data efficiently.

Instructions

    List disk snapshots in a GCP project.
    
    Args:
        project_id: The ID of the GCP project to list snapshots for
    
    Returns:
        List of disk snapshots in the specified GCP project
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes

Implementation Reference

  • The handler function for the 'list_snapshots' tool, decorated with @mcp.tool() for registration. It lists disk snapshots in a GCP project using the Google Cloud Compute API, formats them into a string response.
        @mcp.tool()
        def list_snapshots(project_id: str) -> str:
            """
            List disk snapshots in a GCP project.
            
            Args:
                project_id: The ID of the GCP project to list snapshots for
            
            Returns:
                List of disk snapshots in the specified GCP project
            """
            try:
                from google.cloud import compute_v1
                
                # Initialize the Snapshots client
                client = compute_v1.SnapshotsClient()
                
                # List snapshots
                request = compute_v1.ListSnapshotsRequest(project=project_id)
                snapshots = client.list(request=request)
                
                # Format the response
                snapshots_list = []
                for snapshot in snapshots:
                    size_gb = snapshot.disk_size_gb
                    status = snapshot.status
                    source_disk = snapshot.source_disk.split('/')[-1] if snapshot.source_disk else "Unknown"
                    creation_time = snapshot.creation_timestamp if snapshot.creation_timestamp else "Unknown"
                    
                    snapshots_list.append(f"- {snapshot.name} (Source: {source_disk}, Size: {size_gb} GB, Status: {status}, Created: {creation_time})")
                
                if not snapshots_list:
                    return f"No snapshots found for project {project_id}."
                
                snapshots_str = "\n".join(snapshots_list)
                
                return f"""
    Disk Snapshots in GCP Project {project_id}:
    {snapshots_str}
    """
            except Exception as e:
                return f"Error listing snapshots: {str(e)}"
  • The @mcp.tool() decorator registers the list_snapshots function as an MCP tool.
    @mcp.tool()

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.7/5.0
Behavior3/5

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

No annotations are provided, so the description carries the burden. It discloses a read-only listing operation and a return type ('List of disk snapshots'), but does not mention pagination, required IAM permissions, or behavior with large results.

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

Conciseness4/5

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

The description is organized with Description, Args, and Returns sections, with the purpose front-loaded. The Returns line somewhat repeats the first sentence, but overall it is compact and free of unnecessary detail.

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

Completeness4/5

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

For a low-complexity tool with one parameter and no output schema, the description covers what it does, the scope, the parameter meaning, and the return value. It lacks advanced details like pagination, but these are less critical for a simple list operation.

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

Parameters4/5

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

The input schema has no parameter descriptions (0% coverage), but the description's Args section clarifies project_id as 'The ID of the GCP project to list snapshots for', adding meaning beyond the schema title 'Project Id'.

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

Purpose5/5

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

The description clearly states 'List disk snapshots in a GCP project', using a specific verb and resource. This distinguishes it from sibling tools like list_disks (disks) and create_snapshot (create).

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

Usage Guidelines2/5

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

There is no guidance on when to use this tool versus alternatives. It does not mention scenarios, prerequisites, exclusions, or reference sibling tools such as list_disks or create_snapshot.

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