Skip to main content
Glama

getBucket

Lists files in a cloud storage bucket to view contents and manage stored data. Specify a path prefix to filter results.

Instructions

查询存储桶内的文件列表

Input Schema

NameRequiredDescriptionDefault
PrefixNo文件列表的路径前缀,默认根路径

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "Prefix": { "description": "文件列表的路径前缀,默认根路径", "type": "string" } }, "type": "object" }

Implementation Reference

  • The handler function in CosService that executes the getBucket tool by querying the COS bucket contents using the Tencent COS SDK.
    async getBucket(Prefix = '') { try { const result = await this.cos.getBucket({ Bucket: this.bucket, Region: this.region, Prefix, Delimiter: '', }); return { isSuccess: true, message: '获取列表成功', data: result, }; } catch (error) { return { isSuccess: false, message: '获取列表失败', data: error, }; } }
  • src/server.ts:297-315 (registration)
    Registers the 'getBucket' tool with the MCP server, including input schema (Prefix parameter) and a thin wrapper handler that delegates to CosService.getBucket.
    server.tool( 'getBucket', '查询存储桶内的文件列表', { Prefix: z.string().optional().describe('文件列表的路径前缀,默认根路径'), }, async ({ Prefix = '' }) => { const res = await COSInstance.getBucket(Prefix); return { content: [ { type: 'text', text: JSON.stringify(res.data, null, 2), }, ], isError: !res.isSuccess, }; }, );
  • Zod schema definition for the getBucket tool input: optional Prefix string.
    { Prefix: z.string().optional().describe('文件列表的路径前缀,默认根路径'), },

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/xiaomizhoubaobei/MCP'

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