Skip to main content
Glama
OrionPotter

Meilisearch MCP Server

by OrionPotter

facet-search

Search for facet values matching specific criteria within a Meilisearch index to refine and filter search results.

Instructions

Search for facet values matching specific criteria

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYesUnique identifier of the index
facetNameYesName of the facet to search
facetQueryNoQuery to match against facet values
filterNoFilter to apply to the base search

Implementation Reference

  • Handler function that constructs the request parameters and calls the Meilisearch /facet-search API endpoint, returning the formatted JSON response or error.
    async ({ indexUid, facetName, facetQuery, filter }) => {
      try {
        const params: Record<string, any> = {
          facetName,
        };
        
        if (facetQuery !== undefined) params.facetQuery = facetQuery;
        if (filter) params.filter = filter;
        
        const response = await apiClient.post(`/indexes/${indexUid}/facet-search`, params);
        return {
          content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
        };
      } catch (error) {
        return createErrorResponse(error);
      }
    }
  • Zod input schema defining parameters: indexUid, facetName, facetQuery (optional), and filter (optional).
    {
      indexUid: z.string().describe('Unique identifier of the index'),
      facetName: z.string().describe('Name of the facet to search'),
      facetQuery: z.string().optional().describe('Query to match against facet values'),
      filter: z.string().optional().describe('Filter to apply to the base search'),
    },
  • Registration of the 'facet-search' tool on the MCP server, including name, description, input schema, and handler function.
    server.tool(
      'facet-search',
      'Search for facet values matching specific criteria',
      {
        indexUid: z.string().describe('Unique identifier of the index'),
        facetName: z.string().describe('Name of the facet to search'),
        facetQuery: z.string().optional().describe('Query to match against facet values'),
        filter: z.string().optional().describe('Filter to apply to the base search'),
      },
      async ({ indexUid, facetName, facetQuery, filter }) => {
        try {
          const params: Record<string, any> = {
            facetName,
          };
          
          if (facetQuery !== undefined) params.facetQuery = facetQuery;
          if (filter) params.filter = filter;
          
          const response = await apiClient.post(`/indexes/${indexUid}/facet-search`, params);
          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 facet-search tool among others.
    registerSearchTools(server);
Behavior1/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 but offers minimal information. It doesn't indicate whether this is a read-only operation, what permissions are needed, how results are returned (e.g., pagination, format), or any rate limits. The description fails to provide essential behavioral context for a search operation.

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 with no wasted words. It's appropriately sized for a simple search tool, though it could be more front-loaded with critical context. The structure is clear but minimal.

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 complexity of a search tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what facets are, how results are structured, or provide any behavioral context. The agent lacks sufficient information to use this tool effectively beyond basic parameter passing.

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%, so the schema already documents all four parameters thoroughly. The description adds no additional meaning about parameters beyond what's in the schema (e.g., it doesn't explain relationships between parameters like how 'facetQuery' and 'filter' interact). Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Search for facet values matching specific criteria' states a general purpose but lacks specificity. It mentions 'facet values' and 'search' but doesn't clarify what facets are in this context or how this differs from the sibling 'search' tool. The purpose is vague rather than clearly distinguishing from alternatives.

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 'search' or 'multi-search'. There's no mention of prerequisites, typical use cases, or exclusions. The agent must infer usage from the tool name and parameters alone.

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