Skip to main content
Glama
OrionPotter

Meilisearch MCP Server

by OrionPotter

multi-search

Execute multiple search queries across different indexes in a single request to Meilisearch, reducing API calls and improving efficiency for batch search operations.

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 execution handler for the 'multi-search' MCP tool. It parses the input JSON string containing an array of search objects, validates that each has an 'indexUid', makes a POST request to the '/multi-search' API endpoint using apiClient, and returns the formatted response or error.
      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 parameters for the 'multi-search' tool: a single 'searches' field 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 'MultiSearchParams' defining the expected shape of the handler input parameters.
    interface MultiSearchParams {
      searches: string;
    }
  • The server.tool() registration call for 'multi-search', specifying the tool name, description, input schema, and handler function.
    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)
    Top-level registration call to registerSearchTools(server), which includes the 'multi-search' tool among others, in the main MCP server initialization.
    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 of behavioral disclosure. It mentions performing searches but doesn't specify if this is a read-only operation, potential side effects (e.g., rate limits, authentication needs), or what the output looks like (e.g., aggregated results, error handling). For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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 that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy to parse quickly.

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 no annotations, no output schema, and a single parameter with full schema coverage, the description is incomplete. It lacks details on behavioral traits (e.g., read/write nature, error handling), output format, and usage context compared to siblings. For a tool in a complex server with many search-related alternatives, more guidance is needed.

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 parameter 'searches' documented as a JSON array of search queries with indexUid and q fields. The description adds no additional parameter details beyond what the schema provides, such as format examples or constraints. Baseline 3 is appropriate since the schema does the heavy lifting, but no extra value is added.

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 distinguishes it from the sibling 'search' tool that presumably handles single searches. However, it doesn't explicitly mention what resource is being searched (e.g., documents, indexes), leaving some ambiguity compared to more specific descriptions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when multiple searches are needed simultaneously, suggesting an alternative to repeated single searches. However, it doesn't explicitly state when to use this versus the 'search' tool or other search-related siblings like 'facet-search' or 'vector-search', nor does it mention any prerequisites or exclusions.

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/OrionPotter/iflow-mcp_meilisearch-ts-mcp'

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