assessQuality
Analyze image quality by processing stored image files to evaluate visual characteristics and technical parameters.
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/server.ts:345-356 (handler)MCP tool handler that calls the assessQuality service method on CIAIInstance and formats the result into MCP content structure with error flag.async ({ objectKey }) => { const res = await CIAIInstance.assessQuality(objectKey); return { content: [ { type: 'text', text: JSON.stringify(res.data, null, 2), }, ], isError: !res.isSuccess, }; },
- src/server.ts:342-344 (schema)Zod input schema defining the 'objectKey' parameter for the assessQuality tool.{ objectKey: z.string().describe('图片在存储桶里的路径'), },
- src/server.ts:339-357 (registration)Registration of the 'assessQuality' tool using server.tool, specifying name, description, input schema, and handler function.server.tool( 'assessQuality', '图片处理-图片质量评估', { objectKey: z.string().describe('图片在存储桶里的路径'), }, async ({ objectKey }) => { const res = await CIAIInstance.assessQuality(objectKey); return { content: [ { type: 'text', text: JSON.stringify(res.data, null, 2), }, ], isError: !res.isSuccess, }; }, );
- src/services/ci/ai.service.ts:64-88 (helper)Core helper function in CIAIService class that performs the Tencent Cloud COS image quality assessment via CI process request.async assessQuality(objectKey: string) { try { const result = await this.cos.request({ Bucket: this.bucket, Region: this.region, Method: 'GET', Key: objectKey, Query: { 'ci-process': 'AssessQuality', }, }); return { isSuccess: true, message: '图片处理成功', data: result, }; } catch (error) { return { isSuccess: false, message: '图片处理失败', data: error, }; } }