list-buckets
Retrieve a list of all available Amazon S3 buckets in your AWS account to manage storage resources and organize data.
Instructions
List available S3 buckets
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/listBuckets.ts:40-57 (handler)The `execute` method of `ListBucketsTool` that implements the core logic: lists S3 buckets via `s3Resource.listBuckets()`, formats as JSON, and handles errors.async execute(_args: Record<string, never>) { try { const buckets = await this.s3Resource.listBuckets(); return { content: [ { type: "text" as const, text: JSON.stringify(buckets, null, 2), }, ], }; } catch (error) { return createErrorResponse( error, `Error listing buckets: ${error instanceof Error ? error.message : String(error)}`, ); } }
- src/tools/listBuckets.ts:22-22 (schema)Defines the input parameters schema for the tool (empty object, no parameters required).readonly parameters = {} as const;
- src/server.ts:28-31 (registration)Registers the `list-buckets` tool (among others) on the MCP server by calling `server.tool()` with name, description, parameters, and bound execute method.const tools = createTools(s3Resource); for (const tool of tools) { server.tool(tool.name, tool.description, tool.parameters, tool.execute.bind(tool)); }
- src/tools/index.ts:14-17 (registration)Instantiates `ListBucketsTool` as part of `createTools()` function, which supplies the tool instance for registration.new ListBucketsTool(s3Resource), new ListObjectsTool(s3Resource), new GetObjectTool(s3Resource), ];