Skip to main content
Glama
Tencent

Tencent Cloud COS MCP Server

Official
by Tencent

getBucket

Retrieve a list of files from a specified bucket in Tencent Cloud COS using the MCP protocol, enabling direct access and management of stored data without coding.

Instructions

查询存储桶内的文件列表

Input Schema

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

Implementation Reference

  • MCP tool registration and handler for 'getBucket'. Defines input schema for Prefix parameter, executes by calling CosService.getBucket(Prefix), and returns JSON-formatted result with error flag.
    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, }; }, );
  • Input schema for getBucket tool using Zod: optional Prefix string.
    { Prefix: z.string().optional().describe('文件列表的路径前缀,默认根路径'), },
  • Helper method in CosService that performs the actual COS getBucket API call with bucket/region/Prefix/Delimiter, handles try-catch, returns structured response.
    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, }; }

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/Tencent/cos-mcp'

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