list-s3-buckets
Retrieve a comprehensive list of all S3 buckets in your AWS account. Specify the region or use the default to streamline bucket management and access.
Instructions
List all S3 buckets in your AWS account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| region | No | AWS region (optional, defaults to configured region) |
Implementation Reference
- src/s3_tools/server.py:41-61 (handler)Executes the list-s3-buckets tool by creating an S3 client with optional region, listing all buckets, and returning a formatted text list or error message.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)}" ) ]
- src/s3_tools/server.py:22-30 (schema)JSON schema defining the input parameters for the list-s3-buckets tool, including an optional 'region' string.inputSchema={ "type": "object", "properties": { "region": { "type": "string", "description": "AWS region (optional, defaults to configured region)", } } },
- src/s3_tools/server.py:19-31 (registration)Registers the list-s3-buckets tool in the handle_list_tools() response, providing name, description, and input schema.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)", } } }, )