Skip to main content
Glama
devlimelabs

Meilisearch MCP Server

by devlimelabs

facet-search

Search for facet values matching specific criteria in Meilisearch indexes 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

  • Registration of the 'facet-search' MCP tool using server.tool, including 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);
        }
      }
    );
  • Handler function for 'facet-search' tool: constructs parameters and performs POST request to Meilisearch /facet-search endpoint, returns 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 for 'facet-search' tool parameters: indexUid, facetName, optional facetQuery and filter.
    {
      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'),
    },
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 'searching' but does not clarify if this is a read-only operation, what the output format might be, or any performance considerations like rate limits. The description adds minimal behavioral context beyond the basic action.

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 is front-loaded with the core action ('Search for facet values'), though it could be more structured by explicitly mentioning parameters or context.

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 fails to explain what facet values are, how results are returned, or any error conditions, leaving significant gaps for an AI agent to understand and use the tool effectively.

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 (indexUid, facetName, facetQuery, filter). The description adds no additional meaning or examples beyond what the schema provides, such as explaining how 'facetQuery' differs from regular queries. 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 purpose (searching facet values) but is vague about what 'facet values' are and how this differs from general search tools like 'search' or 'multi-search' in the sibling list. It uses a specific verb ('Search') but lacks clarity on the resource scope beyond 'facet values'.

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', nor does it mention prerequisites or exclusions. It implies usage for searching facet values but leaves the agent to infer context from the tool name 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/devlimelabs/meilisearch-ts-mcp'

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