Skip to main content
Glama

list-s3-buckets

Retrieve all S3 buckets in your AWS account to manage storage, monitor resources, and organize data across regions.

Instructions

List all S3 buckets in your AWS account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regionNoAWS region (optional, defaults to configured region)

Implementation Reference

  • Handler logic for the 'list-s3-buckets' tool within the handle_call_tool function. It uses boto3 to create an S3 client, list all buckets, format them into a text response, or return an error message if a ClientError occurs.
    if name == "list-s3-buckets": try: region = arguments.get("region") if arguments else None s3_client = boto3.client('s3', region_name=region) if region else boto3.client('s3') response = s3_client.list_buckets() buckets = [bucket['Name'] for bucket in response['Buckets']] return [ types.TextContent( type="text", text=f"Found {len(buckets)} S3 buckets:\n" + "\n".join(f"- {bucket}" for bucket in buckets) ) ] except ClientError as e: return [ types.TextContent( type="text", text=f"Error listing S3 buckets: {str(e)}" ) ]
  • Registration of the 'list-s3-buckets' tool in the handle_list_tools function, including its name, description, and JSON schema for input validation (region parameter).
    types.Tool( name="list-s3-buckets", description="List all S3 buckets in your AWS account", inputSchema={ "type": "object", "properties": { "region": { "type": "string", "description": "AWS region (optional, defaults to configured region)", } } }, ) ]
  • JSON schema definition for the 'list-s3-buckets' tool input, defining an optional 'region' string parameter.
    inputSchema={ "type": "object", "properties": { "region": { "type": "string", "description": "AWS region (optional, defaults to configured region)", } } },
Install Server

Other Tools

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/sofianhamiti/mcp-server-s3'

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