Skip to main content
Glama

aiQrcode

Extract text and data from QR code images stored in cloud storage buckets using image processing and recognition capabilities.

Instructions

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

Input Schema

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

Implementation Reference

  • Core implementation of the aiQrcode tool handler in the CIAIService class. Performs QR code recognition by sending a GET request to Tencent COS with ci-process: QRcode query parameter.
    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)
    Registration of the 'aiQrcode' MCP tool, including name, description, Zod input schema for objectKey, and wrapper handler that calls the service method and formats the 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 aiQrcode tool input parameter 'objectKey'.
    {
      objectKey: z
        .string()
        .describe('COS对象键(完整路径)示例: images/qrcode.jpg'),
    },
  • Instantiation of the CIAIService instance used by the aiQrcode tool.
    const CIAIInstance = new CIAIService(bucket, region, cos);
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 of behavioral disclosure. It states the tool recognizes QR code content from images in a storage bucket, implying a read-only operation that returns extracted text. However, it doesn't describe error handling (e.g., for invalid images), performance traits (e.g., speed), or output format (e.g., plain text or structured data). For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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

Conciseness4/5

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

The description is a single, efficient Chinese phrase: '图片处理-二维码识别-识别存储桶内二维码图片内容'. It's front-loaded with the core purpose and avoids unnecessary words. However, it could be slightly more structured (e.g., separating function from scope) for clarity, but it's highly concise with zero waste.

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

Completeness3/5

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

Given the tool's moderate complexity (QR code recognition from images), lack of annotations, and no output schema, the description is minimally adequate. It covers the basic purpose and scope but misses details like output format, error conditions, and usage context. For a tool with no structured behavioral data, it should provide more completeness to guide an AI agent effectively.

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 input schema has 100% description coverage for its single parameter 'objectKey', which is documented as 'COS对象键(完整路径)示例: images/qrcode.jpg' (COS object key - full path example: images/qrcode.jpg). The description doesn't add any parameter-specific information beyond what the schema provides, such as format constraints or examples. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but doesn't need to heavily.

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 'imageSearchPic' or 'imageSearchText' that also process images, though the QR code focus is distinct.

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 an image in the storage bucket), exclusions (e.g., non-QR code images), or comparisons to siblings like 'imageSearchPic' for general image search. Usage is implied by the scope ('in storage bucket') but lacks explicit context.

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