Skip to main content
Glama
devlimelabs

Meilisearch MCP Server

by devlimelabs

multi-search

Execute multiple search queries simultaneously across Meilisearch indexes in a single API request to reduce network overhead and improve efficiency.

Instructions

Perform multiple searches in one request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
searchesYesJSON array of search queries, each with indexUid and q fields

Implementation Reference

  • The main handler function for the 'multi-search' tool. Parses the JSON string of search objects, validates that it's an array with indexUid in each, calls the Meilisearch /multi-search API, and returns the JSON response as text content.
    async ({ searches }: MultiSearchParams) => {
      try {
        // Parse the searches string to ensure it's valid JSON
        const parsedSearches = JSON.parse(searches);
        
        // Ensure searches is an array
        if (!Array.isArray(parsedSearches)) {
          return {
            isError: true,
            content: [{ type: 'text', text: 'Searches must be a JSON array' }],
          };
        }
        
        // Ensure each search has at least indexUid
        for (const search of parsedSearches) {
          if (!search.indexUid) {
            return {
              isError: true,
              content: [{ type: 'text', text: 'Each search must have an indexUid field' }],
            };
          }
        }
        
        const response = await apiClient.post('/multi-search', {
          queries: parsedSearches,
        });
        return {
          content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
        };
      } catch (error) {
        return createErrorResponse(error);
      }
    }
  • Zod schema defining the input parameter 'searches' as a string containing JSON array of search queries.
    {
      searches: z.string().describe('JSON array of search queries, each with indexUid and q fields'),
    },
  • TypeScript interface defining the input type for the multi-search handler.
    interface MultiSearchParams {
      searches: string;
    }
  • Full registration block for the 'multi-search' tool using server.tool(), including comment, name, description, input schema, and handler function.
    // Multi-search across multiple indexes
    server.tool(
      'multi-search',
      'Perform multiple searches in one request',
      {
        searches: z.string().describe('JSON array of search queries, each with indexUid and q fields'),
      },
      async ({ searches }: MultiSearchParams) => {
        try {
          // Parse the searches string to ensure it's valid JSON
          const parsedSearches = JSON.parse(searches);
          
          // Ensure searches is an array
          if (!Array.isArray(parsedSearches)) {
            return {
              isError: true,
              content: [{ type: 'text', text: 'Searches must be a JSON array' }],
            };
          }
          
          // Ensure each search has at least indexUid
          for (const search of parsedSearches) {
            if (!search.indexUid) {
              return {
                isError: true,
                content: [{ type: 'text', text: 'Each search must have an indexUid field' }],
              };
            }
          }
          
          const response = await apiClient.post('/multi-search', {
            queries: parsedSearches,
          });
          return {
            content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
          };
        } catch (error) {
          return createErrorResponse(error);
        }
      }
    );
  • src/index.ts:66-66 (registration)
    Invocation of registerSearchTools which registers the search tools including 'multi-search' on the main MCP server instance.
    registerSearchTools(server);
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. It states the tool performs searches but doesn't disclose behavioral traits such as whether it's read-only, potential rate limits, error handling for partial failures, or the format of results. This leaves significant gaps for an agent to understand how to use it effectively.

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?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core purpose and appropriately sized for the tool's complexity.

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 doesn't explain what the tool returns (e.g., aggregated results, error responses) or provide context on usage scenarios. For a tool that likely returns complex data, this leaves the agent with insufficient information.

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 'searches' parameter fully documented in the schema. The description adds no additional meaning beyond the schema, such as examples of the JSON array structure or constraints on the number of searches. Baseline 3 is appropriate since the schema does the heavy lifting.

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 action ('perform multiple searches') and the scope ('in one request'), which is specific and distinguishes it from the basic 'search' tool. However, it doesn't explicitly contrast with other search-related tools like 'facet-search' or 'vector-search', so it's not fully differentiated from all siblings.

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 like the standard 'search' tool or other search-related siblings. It lacks any mention of prerequisites, performance considerations, or specific scenarios where batching searches is beneficial.

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/devlimelabs/meilisearch-ts-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server