list-buckets
Retrieve a list of available S3 buckets using the S3 MCP Server, enabling LLMs to interact with AWS S3 storage for bucket management and data access.
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 main handler function for the 'list-buckets' tool. It invokes S3Resource.listBuckets() to retrieve the list of buckets, stringifies the result as JSON, and returns it as text content, or handles errors with createErrorResponse.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:12-22 (schema)Tool metadata including name 'list-buckets', description, and input parameters schema (empty object indicating no parameters required).readonly name = "list-buckets"; /** * Tool description */ readonly description = "List available S3 buckets"; /** * Parameter definition (empty for this tool) */ readonly parameters = {} as const;
- src/server.ts:28-31 (registration)Registers all MCP tools, including 'list-buckets', on the McpServer instance using server.tool() with the tool's 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:12-18 (registration)Factory function that instantiates the ListBucketsTool (for 'list-buckets') along with other tools, providing the shared S3Resource dependency.export function createTools(s3Resource: S3Resource): IMCPTool[] { return [ new ListBucketsTool(s3Resource), new ListObjectsTool(s3Resource), new GetObjectTool(s3Resource), ]; }