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()
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states it's a listing operation, which implies read-only behavior, but doesn't mention authentication requirements, rate limits, pagination behavior, or what format the returned list takes. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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

Conciseness5/5

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

The description is efficiently structured with a clear purpose statement followed by Args and Returns sections. Every sentence serves a purpose with no wasted words, and the information is appropriately front-loaded.

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

Completeness3/5

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

For a simple listing tool with one parameter and no output schema, the description covers the basic purpose and parameter meaning adequately. However, without annotations and with no output schema, it should ideally describe the return format more specifically than just 'List of disk snapshots' to be fully complete.

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?

With only one parameter and 0% schema description coverage, the description compensates well by explaining what 'project_id' represents ('The ID of the GCP project to list snapshots for'). This adds meaningful context beyond the schema's basic string type, though it doesn't specify format requirements (like project ID patterns).

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

Purpose4/5

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

The description clearly states the verb ('List') and resource ('disk snapshots in a GCP project'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'list_disks' or 'list_compute_instances' that also list GCP resources, so it doesn't reach the highest clarity level.

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?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of when this tool is appropriate compared to other listing tools (like 'list_disks' or 'list_assets'), nor any prerequisites or context for usage.

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

Related 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/henihaddad/gcp-mcp'

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