aiSuperResolution
Enhance image resolution using advanced AI technology. Integrated with Tencent Cloud COS MCP Server, it processes images directly from cloud storage, delivering higher quality outputs without manual coding.
Instructions
图片处理-超分辨率
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| objectKey | Yes | 图片在存储桶里的路径 |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"objectKey": {
"description": "图片在存储桶里的路径",
"type": "string"
}
},
"required": [
"objectKey"
],
"type": "object"
}
Implementation Reference
- src/services/ci/ai.service.ts:15-61 (handler)The aiSuperResolution method in CIAIService class that executes the AI super resolution image processing using Tencent COS API with rule 'ci-process=AISuperResolution'.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:360-377 (registration)Registers the 'aiSuperResolution' tool in the MCP server, defining the schema (objectKey: string) and handler that calls CIAIInstance.aiSuperResolution.'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, }; }, );