Skip to main content
Glama
devlimelabs

Meilisearch MCP Server

by devlimelabs

facet-search

Filter and search specific facet values in Meilisearch indexes using defined criteria, enabling precise data retrieval and enhanced search functionality.

Instructions

Search for facet values matching specific criteria

Input Schema

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

Implementation Reference

  • The async handler function that performs the 'facet-search' tool logic by constructing parameters and posting to the Meilisearch `/indexes/${indexUid}/facet-search` endpoint.
    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); } }
  • Input schema using Zod for the 'facet-search' tool parameters.
    { 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'), },
  • The server.tool registration of the 'facet-search' tool, including description, schema, and handler.
    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)
    Top-level call to registerSearchTools which registers the 'facet-search' tool among search tools.
    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/devlimelabs/meilisearch-ts-mcp'

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