Skip to main content
Glama
OrionPotter

Meilisearch MCP Server

by OrionPotter

facet-search

Find facet values in a Meilisearch index by specifying a facet name and query to match against values, with optional filtering.

Instructions

Search for facet values matching specific criteria

Input 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

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "facetName": { "description": "Name of the facet to search", "type": "string" }, "facetQuery": { "description": "Query to match against facet values", "type": "string" }, "filter": { "description": "Filter to apply to the base search", "type": "string" }, "indexUid": { "description": "Unique identifier of the index", "type": "string" } }, "required": [ "indexUid", "facetName" ], "type": "object" }

Implementation Reference

  • Handler function that performs the facet-search by calling the Meilisearch API's facet-search endpoint with the provided parameters.
    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 for the facet-search tool: 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'), },
  • Registration of the 'facet-search' tool on the MCP server within the registerSearchTools function, including name, 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)
    Invocation of registerSearchTools on the main MCP server instance, 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