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);

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