Skip to main content
Glama

imageSearchPic

Search for visually similar images in a dataset by providing an input image URL. This tool enables content-based image retrieval for finding matching or related visual content.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uriYes图片地址

Implementation Reference

  • The main handler function that validates input, constructs the COS API request for image search by picture, and returns the result or error.
    async imageSearchPic(params: ImageSearchPicParams) {
      // 验证并解析参数
      const validParams = ImageSearchPicParamsSchema.parse(params);
      const { uri } = 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: 'pic',
          URI: uri,
        });
    
        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 {
          success: true,
          message: '图像检索成功',
          // data: result.Body.toString()
          data: result,
        };
      } catch (error) {
        return {
          isSuccess: false,
          message: '图像检索失败',
          data: error,
        };
      }
    }
  • Zod schema and TypeScript type definition for the imageSearchPic tool parameters (uri: string). Used for input validation within the handler.
    export const ImageSearchPicParamsSchema = z.object({
      uri: z.string(),
    });
    export type ImageSearchPicParams = z.infer<typeof ImageSearchPicParamsSchema>;
  • src/server.ts:491-509 (registration)
    MCP server tool registration for 'imageSearchPic', defining the input schema, description, and wrapper handler that delegates to the CIMateInsightService instance.
    server.tool(
      'imageSearchPic',
      '根据输入的图片,从数据集中检索出与输入的图片内容相似的图片',
      {
        uri: z.string().describe('图片地址'),
      },
      async ({ uri }) => {
        const res = await CIMateInsightInstance.imageSearchPic({ uri });
        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?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool retrieves similar images but doesn't describe what 'similar' means (visual similarity, semantic similarity, etc.), how many results are returned, whether there's pagination, what format results come in, or any limitations/constraints. For a search tool with zero annotation coverage, this is inadequate behavioral 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 states the core functionality. There's no wasted text or unnecessary elaboration. However, it could be more front-loaded with key behavioral information given the lack of annotations. The conciseness is good but comes at the cost of completeness.

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 this is a search tool with no annotations, no output schema, and minimal behavioral description, the description is incomplete. It doesn't explain what constitutes 'similar' images, how results are ranked/formatted, what dataset is being searched, or any limitations. For a tool that presumably returns multiple results, the lack of output information is a significant gap.

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 the single parameter 'uri' described as '图片地址' (image address). The description adds that this is an input image for similarity search, which provides some context beyond the schema's 'image address' description. However, it doesn't elaborate on supported URI formats, size limits, or content requirements. With high schema coverage, baseline 3 is appropriate.

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 similar images from a dataset based on input image content). It specifies the verb ('检索出' - retrieve) and resource ('图片' - images), but doesn't distinguish from its sibling 'imageSearchText' which likely performs text-based image search. The purpose is clear but lacks sibling differentiation.

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 doesn't mention the sibling tool 'imageSearchText' or any other image-related tools in the list. There's no context about prerequisites, dataset characteristics, or performance expectations. The description only states what the tool does, not when to choose it.

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