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

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

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('文件列表的路径前缀,默认根路径'),
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While '查询' (query) implies a read-only operation, it doesn't specify whether this lists all files, supports pagination, returns metadata only, or has any access restrictions. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient Chinese sentence that directly states the tool's purpose without any unnecessary words or structural issues. It's appropriately sized for what it communicates.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a read operation that likely returns structured data, the description is insufficient. It doesn't explain what the output contains (file names, metadata, pagination tokens) or any behavioral constraints. For a tool in a storage system context with multiple retrieval alternatives, more completeness is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 100% description coverage for its single parameter, so the baseline is 3. The description doesn't add any parameter-specific information beyond what's already in the schema's description of 'Prefix' as '文件列表的路径前缀,默认根路径' (path prefix for file list, default root path).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '查询存储桶内的文件列表' clearly states the purpose as 'query file list within storage bucket' in English, which is a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'getObject' or 'imageSearchText' that might also retrieve bucket contents, so it doesn't achieve full sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There are multiple sibling tools for retrieving bucket data (getObject, getObjectUrl, imageSearchText, etc.), but the description doesn't indicate this is specifically for listing files rather than retrieving content or searching.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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