Skip to main content
Glama

imageSearchText

Search for images in a dataset using text queries to find matching visual content based on natural language descriptions.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes检索的文本

Implementation Reference

  • Core handler function implementing the imageSearchText tool logic using Tencent Cloud CI API for text-based image search.
    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 and TypeScript type definition for input parameters of the imageSearchText tool.
    export const ImageSearchTextParamsSchema = z.object({
      text: z.string(),
    });
    export type ImageSearchTextParams = z.infer<typeof ImageSearchTextParamsSchema>;
  • src/server.ts:511-529 (registration)
    MCP server registration of the 'imageSearchText' tool, including inline input schema and delegation to the service handler.
    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 the full burden of behavioral disclosure. It only states the basic action of retrieving images, without details on permissions, rate limits, dataset scope, or response format (e.g., pagination, error handling). For a retrieval tool with zero annotation coverage, this is a significant gap in transparency.

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 sentence that directly states the tool's function without unnecessary words. It is front-loaded and clear, though it could be slightly more structured (e.g., by adding usage context). Overall, it earns its place concisely.

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?

Given the lack of annotations and output schema, the description is incomplete. It does not cover behavioral aspects like dataset details, result format, or error conditions. For a retrieval tool with no structured support, the description should provide more context to ensure reliable 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?

The description adds minimal meaning beyond the input schema, which has 100% coverage for the single parameter 'text'. It implies the text is used for matching images but does not elaborate on syntax, language, or matching criteria. With high schema coverage, the baseline is 3, as the schema already documents the parameter adequately.

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 from a dataset that match the input text content.' It specifies both the verb ('retrieve') and the resource ('images'), making the function unambiguous. However, it does not explicitly differentiate from sibling tools like 'imageSearchPic' (which likely searches by image rather than text), so it misses the highest score.

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 does not mention sibling tools (e.g., 'imageSearchPic' for image-based searches) or any contextual prerequisites, leaving the agent to infer usage based on the tool name alone. This lack of explicit guidance limits its effectiveness in tool selection.

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