Skip to main content
Glama

get_bucket_details

Retrieve detailed information about a specific Cloud Storage bucket in Google Cloud Platform by providing the project ID and bucket name.

Instructions

Get detailed information about a specific Cloud Storage bucket. Args: project_id: The ID of the GCP project bucket_name: The name of the bucket to get details for Returns: Detailed information about the specified Cloud Storage bucket

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucket_nameYes
project_idYes

Implementation Reference

  • The handler function for the 'get_bucket_details' tool. It uses the Google Cloud Storage client to retrieve bucket details including name, location, storage class, creation time, versioning, labels, and more, then formats them into a string response.
    @mcp.tool() def get_bucket_details(project_id: str, bucket_name: str) -> str: """ Get detailed information about a specific Cloud Storage bucket. Args: project_id: The ID of the GCP project bucket_name: The name of the bucket to get details for Returns: Detailed information about the specified Cloud Storage bucket """ 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) # Format the response details = [] details.append(f"Name: {bucket.name}") details.append(f"Project: {project_id}") details.append(f"Location: {bucket.location or 'Unknown'}") details.append(f"Storage Class: {bucket.storage_class or 'Unknown'}") details.append(f"Created: {bucket.time_created.strftime('%Y-%m-%d %H:%M:%S UTC') if bucket.time_created else 'Unknown'}") details.append(f"Versioning Enabled: {bucket.versioning_enabled}") details.append(f"Requester Pays: {bucket.requester_pays}") details.append(f"Lifecycle Rules: {len(bucket.lifecycle_rules) if bucket.lifecycle_rules else 0} rules defined") details.append(f"Labels: {bucket.labels or 'None'}") details.append(f"CORS: {bucket.cors or 'None'}") details_str = "\n".join(details) return f""" Cloud Storage Bucket Details: {details_str} """ except Exception as e: return f"Error getting bucket details: {str(e)}"
  • Top-level registration call for all storage tools, including 'get_bucket_details', by invoking the register_tools function from the storage module.
    storage_tools.register_tools(mcp)
  • The register_tools function in the storage module that defines and registers the 'get_bucket_details' tool using @mcp.tool() decorator.
    def register_tools(mcp): """Register all storage tools with the MCP server."""

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