Skip to main content
Glama
Tencent

Tencent Cloud COS MCP Server

Official
by Tencent

imageSearchText

Retrieve images matching input text from a dataset stored on Tencent Cloud COS MCP Server, enabling efficient visual content search and retrieval.

Instructions

根据输入的文本内容,从数据集中检索出与输入的文本内容相符的图片

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes检索的文本

Implementation Reference

  • The main handler function implementing the imageSearchText tool logic. It validates input using Zod schema, constructs a request to Tencent Cloud CI datasetquery/imagesearch endpoint with Mode: 'text', and returns search results or error.
    async imageSearchText(params: ImageSearchTextParams) {
      // 验证并解析参数
      const validParams = ImageSearchTextParamsSchema.parse(params);
      const { text } = validParams;
    
      try {
        const key = 'datasetquery/imagesearch'; // 固定值
        const appid = this.bucket.split('-').pop();
    
        const host = `${appid}.ci.${this.region}.myqcloud.com`;
        const url = `https://${host}/${key}`;
        const body = JSON.stringify({
          DatasetName: this.datasetName,
          Mode: 'text',
          Text: text,
        });
    
        const result = await this.cos.request({
          Method: 'POST', // 固定值,必须
          Key: key, // 必须
          Url: url, // 请求的url,必须
          Body: body, // 请求体参数,必须
          Headers: {
            // 设置请求体为 json,固定值,必须
            'Content-Type': 'application/json',
            // 设置响应体为json,固定值,必须
            Accept: 'application/json',
          },
        });
    
        return {
          isSuccess: true,
          message: '图像检索成功',
          data: result,
        };
      } catch (error) {
        return {
          isSuccess: false,
          message: '请求异常: ${error.message}',
          data: error,
        };
      }
    }
  • Zod schema defining input parameters for the imageSearchText handler: expects a 'text' string.
    export const ImageSearchTextParamsSchema = z.object({
      text: z.string(),
    });
    export type ImageSearchTextParams = z.infer<typeof ImageSearchTextParamsSchema>;
  • src/server.ts:511-529 (registration)
    MCP server tool registration. Defines the tool name 'imageSearchText', description in Chinese, inline Zod input schema for 'text', and async handler that calls the service method and formats response for MCP.
    server.tool(
      'imageSearchText',
      '根据输入的文本内容,从数据集中检索出与输入的文本内容相符的图片',
      {
        text: z.string().describe('检索的文本'),
      },
      async ({ text }) => {
        const res = await CIMateInsightInstance.imageSearchText({ text });
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(res.data, null, 2),
            },
          ],
          isError: !res.isSuccess,
        };
      },
    );
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states this is a retrieval/search operation but doesn't disclose important behavioral traits: whether this is read-only or has side effects, what dataset is being searched, authentication requirements, rate limits, pagination behavior, or what happens when no matches are found. The description is minimal and lacks operational context.

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?

Extremely concise single sentence that directly states the tool's function. No wasted words or unnecessary elaboration. The description is appropriately sized for a simple search tool with one parameter.

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?

For a search tool with no annotations and no output schema, the description is insufficient. It doesn't explain what kind of dataset is being searched, the format of returned images, error conditions, or limitations. Given the complexity of image search and lack of structured metadata, more context is needed for effective agent use.

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?

Schema description coverage is 100% with one parameter 'text' described as '检索的文本' (search text). The description adds minimal value beyond the schema, only reinforcing that the input is '文本内容' (text content). With high schema coverage, the baseline is 3 even without additional parameter semantics in the description.

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: '从数据集中检索出与输入的文本内容相符的图片' (retrieve images matching input text from a dataset). It specifies the verb '检索' (retrieve/search) and resource '图片' (images), but doesn't distinguish it from sibling 'imageSearchPic' which appears to be a similar image search tool with different input type.

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?

No guidance on when to use this tool versus alternatives. The description doesn't mention when this tool is appropriate versus 'imageSearchPic' or other search/retrieval tools in the sibling list. It provides only the basic functionality without context about appropriate use cases.

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