get_bucket_location
Retrieve the AWS region or geographic location where an S3-compatible storage bucket is hosted to ensure proper API endpoint configuration and data residency compliance.
Instructions
Get the region/location of a bucket
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bucket | Yes | Bucket name |
Implementation Reference
- src/server.ts:287-292 (handler)The MCP tool handler function for 'get_bucket_location' that invokes the S3 client's getBucketLocation method and formats the response as MCP content.async ({ bucket }) => { const location = await this.s3Client.getBucketLocation(bucket); return { content: [{ type: "text", text: JSON.stringify(location) }], }; }
- src/server.ts:284-286 (schema)Zod input schema for the 'get_bucket_location' tool, validating the 'bucket' parameter.{ bucket: z.string().describe("Bucket name"), },
- src/server.ts:281-293 (registration)Registration of the 'get_bucket_location' MCP tool, including name, description, input schema, and inline handler function.this.server.tool( "get_bucket_location", "Get the region/location of a bucket", { bucket: z.string().describe("Bucket name"), }, async ({ bucket }) => { const location = await this.s3Client.getBucketLocation(bucket); return { content: [{ type: "text", text: JSON.stringify(location) }], }; } );
- src/s3Client.ts:176-181 (helper)Helper method in S3Client class that sends GetBucketLocationCommand to retrieve the bucket's location/region.async getBucketLocation(bucket: string) { const command = new GetBucketLocationCommand({ Bucket: bucket, }); return await this.client.send(command); }