Skip to main content
Glama

download_object

Download files from a Google Cloud Storage bucket by specifying the project ID, bucket name, file name, and local save path. Simplify file retrieval for GCP resources.

Instructions

    Download a file from a Cloud Storage bucket.
    
    Args:
        project_id: The ID of the GCP project
        bucket_name: The name of the bucket to download from
        source_blob_name: The name of the file in the bucket
        destination_file_path: The local path to save the file to
    
    Returns:
        Result of the download operation
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucket_nameYes
destination_file_pathYes
project_idYes
source_blob_nameYes

Implementation Reference

  • The handler function for the 'download_object' tool, decorated with @mcp.tool(). It downloads a specified blob from a GCP Cloud Storage bucket to a local destination file path using the google.cloud.storage client.
        @mcp.tool()
        def download_object(project_id: str, bucket_name: str, source_blob_name: str, destination_file_path: str) -> str:
            """
            Download a file from a Cloud Storage bucket.
            
            Args:
                project_id: The ID of the GCP project
                bucket_name: The name of the bucket to download from
                source_blob_name: The name of the file in the bucket
                destination_file_path: The local path to save the file to
            
            Returns:
                Result of the download operation
            """
            try:
                from google.cloud import storage
                
                # Initialize the Storage client
                client = storage.Client(project=project_id)
                
                # Get the bucket
                bucket = client.get_bucket(bucket_name)
                
                # Get the blob
                blob = bucket.blob(source_blob_name)
                
                # Download the file
                blob.download_to_filename(destination_file_path)
                
                return f"""
    File successfully downloaded:
    - Source: gs://{bucket_name}/{source_blob_name}
    - Destination: {destination_file_path}
    - Size: {blob.size / (1024 * 1024):.2f} MB
    - Content-Type: {blob.content_type}
    """
            except Exception as e:
                return f"Error downloading file: {str(e)}"

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden. It states the operation and parameter intent but does not disclose side effects (e.g., overwriting existing files, directory creation), permission requirements, error behavior, or details about the returned 'Result'. The return value is vague and unexplained.

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 properly structured as a docstring with a clear one-sentence summary followed by parameter explanations and a returns line. It is concise and every section serves a purpose, though the 'Returns' line adds little value.

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

Completeness2/5

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

Given the simple nature of the tool, the description covers the basic action, but it is incomplete for an AI agent. It lacks information about overwriting behavior, whether the destination directory must exist, error handling, or authentication requirements. The return value is undefined, and there is no output schema to compensate. The description is insufficient for reliable invocation in many scenarios.

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

Parameters3/5

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

Schema description coverage is 0%, so the one-line explanations in the description add meaning beyond bare parameter names. For instance, 'destination_file_path' is clarified as 'The local path to save the file to', and 'source_blob_name' as 'The name of the file in the bucket'. However, the descriptions are minimal and largely restate the parameter names without deeper semantics like formats or constraints.

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 action with a specific verb ('Download') and resource ('a file from a Cloud Storage bucket'). It distinguishes from sibling tools like upload_object and delete_object by explicitly naming the download operation, though it lacks a broader scope mention (e.g., project-specific).

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. It does not mention prerequisites, when download is appropriate over upload/list, or mention any exclusions. The sibling list includes similar storage tools, but no comparative guidance is given.

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