Skip to main content
Glama

aiSuperResolution

Enhance image resolution using AI processing to improve clarity and detail from stored files.

Instructions

图片处理-超分辨率

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
objectKeyYes图片在存储桶里的路径

Implementation Reference

  • The aiSuperResolution method in CIAIService that executes the AI super resolution image processing using Tencent Cloud COS 'ci-process=AISuperResolution' API.
    async aiSuperResolution(objectKey: string) {
      try {
        const result = await new Promise((resolve, reject) => {
          const outPutFileid = generateOutPutFileId(objectKey);
          this.cos.request(
            {
              Bucket: this.bucket, // 存储桶,必须字段
              Region: this.region, // 存储桶所在地域,必须字段 如 ap-beijing
              Key: objectKey, // 对象文件名,例如:folder/document.jpg。
              Method: 'POST', // 固定值
              Action: 'image_process', // 固定值
              Headers: {
                'Pic-Operations': JSON.stringify({
                  rules: [
                    {
                      fileid: `${outPutFileid}`,
                      rule: 'ci-process=AISuperResolution',
                    },
                  ],
                }),
              },
            },
            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:359-377 (registration)
    Registration of the 'aiSuperResolution' tool in the MCP server using server.tool(), including input schema for objectKey and the wrapper handler that calls CIAIInstance.aiSuperResolution.
    server.tool(
      'aiSuperResolution',
      '图片处理-超分辨率',
      {
        objectKey: z.string().describe('图片在存储桶里的路径'),
      },
      async ({ objectKey }) => {
        const res = await CIAIInstance.aiSuperResolution(objectKey);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(res.data, null, 2),
            },
          ],
          isError: !res.isSuccess,
        };
      },
    );
  • Zod input schema definition for the aiSuperResolution tool: requires objectKey as string describing the image path in the bucket.
      objectKey: z.string().describe('图片在存储桶里的路径'),
    },
  • Creation of CIAIInstance used by the aiSuperResolution tool handler.
    const CIAIInstance = new CIAIService(bucket, region, cos);

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