Skip to main content
Glama
Tencent

Tencent Cloud COS MCP Server

Official
by Tencent

aiQrcode

Extract and decode QR code content from images stored in Tencent Cloud COS using the MCP protocol, enabling efficient data retrieval without manual processing.

Instructions

图片处理-二维码识别-识别存储桶内二维码图片内容

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
objectKeyYesCOS对象键(完整路径)示例: images/qrcode.jpg

Implementation Reference

  • The aiQrcode method in CIAIService class that performs QR code recognition on the specified objectKey using Tencent Cloud COS API (ci-process: 'QRcode'). Returns success/error response with data.
    async aiQrcode(objectKey: string) {
      try {
        const result = await new Promise((resolve, reject) => {
          this.cos.request(
            {
              Bucket: this.bucket, // 存储桶,必须字段
              Region: this.region, // 存储桶所在地域,必须字段 如 ap-beijing
              Method: 'GET',
              Key: objectKey,
              // Url: url,
              Query: {
                'ci-process': 'QRcode', // 数据万象处理能力,二维码识别固定为 QRcode,
                cover: 0,
              },
            },
            function (error, data) {
              if (error) {
                // 处理请求失败
                reject(error);
              } else {
                // 处理请求成功
                resolve(data);
              }
            },
          );
        });
        return {
          isSuccess: true,
          message: '二维码识别成功',
          data: result,
        };
      } catch (error) {
        return {
          isSuccess: false,
          message: '二维码识别失败',
          data: error,
        };
      }
    }
  • src/server.ts:401-421 (registration)
    Registers the 'aiQrcode' MCP tool, providing description, Zod input schema for objectKey, and handler that calls CIAIService.aiQrcode and formats response.
    server.tool(
      'aiQrcode',
      '图片处理-二维码识别-识别存储桶内二维码图片内容',
      {
        objectKey: z
          .string()
          .describe('COS对象键(完整路径)示例: images/qrcode.jpg'),
      },
      async ({ objectKey }) => {
        const res = await CIAIInstance.aiQrcode(objectKey);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(res.data, null, 2),
            },
          ],
          isError: !res.isSuccess,
        };
      },
    );
  • Zod schema definition for the input parameter 'objectKey' of the aiQrcode tool.
    objectKey: z
      .string()
      .describe('COS对象键(完整路径)示例: images/qrcode.jpg'),
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool performs QR code recognition on images in a storage bucket, implying a read-only operation, but doesn't disclose behavioral traits such as error handling (e.g., what happens if the image isn't a QR code), performance characteristics (e.g., processing time), or output format (since no output schema exists). This leaves significant gaps for an AI agent.

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 sentence in Chinese: '图片处理-二维码识别-识别存储桶内二维码图片内容'. It is front-loaded with the core purpose and has zero wasted words, making it highly concise and well-structured for quick understanding.

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 the tool's complexity (image processing with one parameter), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., decoded text, error messages), behavioral details, or usage context. While concise, it fails to provide sufficient information for an AI agent to fully understand how to invoke and interpret results from this tool.

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

Parameters4/5

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

The description doesn't explicitly mention parameters, but with 100% schema description coverage (the single parameter 'objectKey' is well-documented in the schema as 'COS对象键(完整路径)示例: images/qrcode.jpg'), the baseline is 3. The description adds value by clarifying the resource context ('识别存储桶内二维码图片内容' - recognize QR code image content in storage bucket), which implicitly relates to the objectKey parameter, elevating the score slightly.

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 tool's purpose: '图片处理-二维码识别-识别存储桶内二维码图片内容' (Image processing - QR code recognition - recognize QR code image content in storage bucket). It specifies the verb (recognize), resource (QR code images), and scope (in storage bucket). However, it doesn't explicitly differentiate from sibling tools like 'imageInfo' or 'imageSearchPic' that might also process images.

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. It doesn't mention prerequisites (e.g., needing a valid object key), exclusions (e.g., non-QR code images), or comparisons to sibling tools like 'imageInfo' (which might provide general image metadata) or 'imageSearchPic' (which might search images). The scope is implied ('in storage bucket') but not explicitly contrasted.

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

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

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