Skip to main content
Glama

list_s3_buckets

Retrieve all S3 buckets in your AWS account and optionally check for public access configurations to manage storage security.

Instructions

Lists all S3 buckets in the AWS account.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
check_public_accessNoIf true, checks if buckets have public access enabled.

Implementation Reference

  • Implementation of the list_s3_buckets tool handler. Uses S3Client to send ListBucketsCommand to list all buckets. Optionally, if check_public_access is true, checks each bucket's policy status using GetBucketPolicyStatusCommand to determine if public access is enabled.
    if (name === "list_s3_buckets") { const command = new ListBucketsCommand({}); const response = await s3Client.send(command); let buckets = response.Buckets?.map((b) => ({ Name: b.Name, CreationDate: b.CreationDate, IsPublic: undefined as boolean | undefined })) || []; if (args && (args as any).check_public_access) { buckets = await Promise.all(buckets.map(async (b) => { try { if (!b.Name) return b; const policyCmd = new GetBucketPolicyStatusCommand({ Bucket: b.Name }); const policyResponse = await s3Client.send(policyCmd); return { ...b, IsPublic: policyResponse.PolicyStatus?.IsPublic || false }; } catch (error) { // If checks fail (e.g. AccessDenied or no policy context), assume not public or unknown return { ...b, IsPublic: false }; } })); } return { content: [ { type: "text", text: JSON.stringify(buckets, null, 2), }, ], }; }
  • src/index.ts:105-117 (registration)
    Registration of the list_s3_buckets tool in the list of available tools returned by ListToolsRequestHandler, including name, description, and input schema.
    { name: "list_s3_buckets", description: "Lists all S3 buckets in the AWS account.", inputSchema: { type: "object", properties: { check_public_access: { type: "boolean", description: "If true, checks if buckets have public access enabled." } }, }, },
  • Input schema definition for the list_s3_buckets tool, defining optional check_public_access parameter.
    inputSchema: { type: "object", properties: { check_public_access: { type: "boolean", description: "If true, checks if buckets have public access enabled." } }, },

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/Bhavesh8890/MCP-server'

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