Skip to main content
Glama
code-alchemist01

MCP Cloud Services Server

gcp_list_storage_buckets

List all Cloud Storage buckets in a specified Google Cloud Platform project to manage and audit your object storage resources.

Instructions

List all Cloud Storage buckets in GCP

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdNoGCP project ID
regionNoGCP regionus-central1

Implementation Reference

  • Core handler logic that lists GCP Cloud Storage buckets using the @google-cloud/storage client, fetches metadata, and maps to GCPStorageBucket type.
    async listStorageBuckets(): Promise<GCPStorageBucket[]> { await this.initializeClients(); if (!this.storage) throw new Error('Storage client not initialized'); try { const [buckets] = await this.storage.getBuckets(); const bucketList: GCPStorageBucket[] = []; for (const bucket of buckets) { const [metadata] = await bucket.getMetadata(); bucketList.push({ id: bucket.name, type: 'storage', name: bucket.name, projectId: this.projectId, location: metadata.location || this.region, status: 'running', bucketName: bucket.name, storageClass: metadata.storageClass, labels: metadata.labels ? Object.fromEntries( Object.entries(metadata.labels).map(([k, v]) => [k, v || '']) ) : undefined, }); } return bucketList; } catch (error) { throw new Error(`Failed to list storage buckets: ${error instanceof Error ? error.message : String(error)}`); } }
  • Tool handler case in handleGCPTool that invokes GCPAdapter.listStorageBuckets() and formats the response.
    case 'gcp_list_storage_buckets': { const buckets = await adapter.listStorageBuckets(); return { total: buckets.length, buckets: buckets.map((bucket) => ({ id: bucket.id, name: bucket.bucketName, location: bucket.location, storageClass: bucket.storageClass, })), }; }
  • Registers the gcp_list_storage_buckets tool in the gcpTools array, including name, description, and input schema.
    { name: 'gcp_list_storage_buckets', description: 'List all Cloud Storage buckets in GCP', inputSchema: { type: 'object', properties: { projectId: { type: 'string', description: 'GCP project ID', }, region: { type: 'string', description: 'GCP region', default: 'us-central1', }, }, }, },
  • Input schema definition for the tool, specifying projectId and optional region parameters.
    inputSchema: { type: 'object', properties: { projectId: { type: 'string', description: 'GCP project ID', }, region: { type: 'string', description: 'GCP region', default: 'us-central1', }, }, },

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/code-alchemist01/Cloud-mcp_server'

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