Skip to main content
Glama

list_storage_buckets

Retrieve a list of Cloud Storage buckets within a specified GCP project by providing the project ID. This tool helps manage and organize storage resources efficiently.

Instructions

    List Cloud Storage buckets in a GCP project.
    
    Args:
        project_id: The ID of the GCP project to list buckets for
    
    Returns:
        List of Cloud Storage buckets in the specified GCP project
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes

Implementation Reference

  • The handler function for the 'list_storage_buckets' tool, decorated with @mcp.tool(), which lists GCP Cloud Storage buckets for a given project using the google.cloud.storage client.
        @mcp.tool()
        def list_storage_buckets(project_id: str) -> str:
            """
            List Cloud Storage buckets in a GCP project.
            
            Args:
                project_id: The ID of the GCP project to list buckets for
            
            Returns:
                List of Cloud Storage buckets in the specified GCP project
            """
            try:
                from google.cloud import storage
                
                # Initialize the Storage client
                client = storage.Client(project=project_id)
                
                # List buckets
                buckets = client.list_buckets()
                
                # Format the response
                buckets_list = []
                for bucket in buckets:
                    location = bucket.location or "Unknown"
                    storage_class = bucket.storage_class or "Unknown"
                    created = bucket.time_created.strftime("%Y-%m-%d %H:%M:%S UTC") if bucket.time_created else "Unknown"
                    buckets_list.append(f"- {bucket.name} (Location: {location}, Class: {storage_class}, Created: {created})")
                
                if not buckets_list:
                    return f"No Cloud Storage buckets found in project {project_id}."
                
                buckets_str = "\n".join(buckets_list)
                
                return f"""
    Cloud Storage Buckets in GCP Project {project_id}:
    {buckets_str}
    """
            except Exception as e:
                return f"Error listing Cloud Storage buckets: {str(e)}"
  • Registration call for storage tools module, which includes the list_storage_buckets tool, invoked within the main register_tools function.
    # Register storage tools
    storage_tools.register_tools(mcp)
  • The register_tools function in the storage module where the list_storage_buckets tool is defined and registered via decorator when called.
    def register_tools(mcp):
        """Register all storage tools with the MCP server."""

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4/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 full burden. The word 'List' implies a read-only operation and the return of a list of buckets. However, it does not disclose permissions, pagination, or error behavior. For a simple list operation, this is adequate but not rich.

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 concise and well-structured: a clear operation sentence, followed by an Args section and a Returns section. There is no redundant text, making it easy to parse quickly.

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?

The tool is simple (one parameter, no output schema), and the description covers the purpose, the parameter, and the return type. It is complete enough for an agent to invoke correctly, though it omits details about permissions or edge cases that could be important in some contexts.

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 schema has 0% description coverage for project_id, but the description's Args section explicitly defines it: 'The ID of the GCP project to list buckets for'. This fully compensates for the schema's lack, giving clear semantic meaning to the only parameter.

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 Cloud Storage buckets in a GCP project', using a specific verb and resource with a defined scope. This distinguishes it from sibling tools like get_bucket_details, which targets a single bucket. The Args and Returns sections further clarify the operation.

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

Usage Guidelines3/5

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

The description gives no explicit guidance on when to use this tool versus alternatives, nor does it mention exclusions. Usage is implied by the purpose and the required project_id, but there is no reference to sibling tools like get_bucket_details for single-bucket lookups.

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