Skip to main content
Glama
list-buckets.ts1.58 kB
/** * list_buckets tool implementation * Lists all storage buckets in the configured source */ import { z } from "zod"; import { ProviderManager } from "../providers/manager.js"; import { createToolSuccessResponse, createToolErrorResponse } from "../utils/response-formatter.js"; /** * Schema for list_buckets tool (no parameters needed) */ export const listBucketsSchema = {}; /** * Get metadata for list_buckets tool */ export function getListBucketsMetadata(sourceId: string) { const toolName = sourceId === "default" ? "list_buckets" : `list_buckets_${sourceId}`; return { name: toolName, title: `List Buckets (${sourceId})`, description: `List all storage buckets available in the '${sourceId}' source. Returns bucket names, creation dates, and locations.`, schema: listBucketsSchema, annotations: { title: `list_buckets (${sourceId})`, readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, }; } /** * Create list_buckets tool handler for a specific source */ export function createListBucketsToolHandler(sourceId?: string) { return async (_args: any, _extra: any) => { try { const provider = ProviderManager.getCurrentProvider(sourceId); const buckets = await provider.listBuckets(); return createToolSuccessResponse({ buckets, count: buckets.length, source_id: sourceId || "default", }); } catch (error) { return createToolErrorResponse((error as Error).message, "LIST_BUCKETS_ERROR"); } }; }

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/zq940222/OssHub'

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