Skip to main content
Glama
code-alchemist01

MCP Cloud Services Server

aws_list_s3_buckets

Retrieve a list of all S3 buckets in your AWS account to manage storage resources and monitor bucket inventory across regions.

Instructions

List all S3 buckets in AWS

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regionNoAWS regionus-east-1

Implementation Reference

  • Tool-specific handler in handleAWSTool function that invokes the AWSAdapter to list S3 buckets and formats the response with total count and bucket details.
    case 'aws_list_s3_buckets': { const buckets = await adapter.listS3Buckets(); return { total: buckets.length, buckets: buckets.map((bucket) => ({ id: bucket.id, name: bucket.bucketName, region: bucket.region, creationDate: bucket.creationDate, })), }; }
  • Core implementation in AWSAdapter that initializes S3 client, lists all buckets using AWS SDK, determines each bucket's region, and maps to standardized S3Bucket format.
    async listS3Buckets(): Promise<S3Bucket[]> { await this.initializeClients(); if (!this.s3Client) throw new Error('S3 client not initialized'); try { const command = new ListBucketsCommand({}); const response = await this.s3Client.send(command); const buckets: S3Bucket[] = []; for (const bucket of response.Buckets || []) { // Get bucket location let location = this.region; try { const locationCommand = new GetBucketLocationCommand({ Bucket: bucket.Name }); const locationResponse = await this.s3Client.send(locationCommand); location = locationResponse.LocationConstraint || this.region; } catch { // Use default region if location fetch fails } buckets.push({ id: bucket.Name || '', type: 'storage', name: bucket.Name || '', region: location, status: 'running', bucketName: bucket.Name || '', creationDate: bucket.CreationDate, }); } return buckets; } catch (error) { throw new Error(`Failed to list S3 buckets: ${error instanceof Error ? error.message : String(error)}`); } }
  • Input schema and metadata definition for the aws_list_s3_buckets tool, including optional region parameter.
    { name: 'aws_list_s3_buckets', description: 'List all S3 buckets in AWS', inputSchema: { type: 'object', properties: { region: { type: 'string', description: 'AWS region', default: 'us-east-1', }, }, }, },
  • src/server.ts:19-27 (registration)
    Registers the aws_list_s3_buckets tool by including it in the awsTools array which is spread into the main allTools list exposed to the MCP server for tool listing.
    const allTools = [ ...awsTools, ...azureTools, ...gcpTools, ...resourceManagementTools, ...costAnalysisTools, ...monitoringTools, ...securityTools, ];
  • src/server.ts:64-65 (registration)
    Routes execution of aws_list_s3_buckets and other AWS tools to the dedicated handleAWSTool function in the main tool call handler.
    if (awsTools.some((t) => t.name === name)) { result = await handleAWSTool(name, args || {});

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