get-filterable-attributes
Retrieve filterable attributes for a specific index in Meilisearch, enabling structured data filtering for AI assistants via the Model Context Protocol.
Instructions
Get the filterable attributes setting
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| indexUid | Yes | Unique identifier of the index |
Implementation Reference
- src/tools/settings-tools.ts:155-163 (handler)Shared handler function that executes the get-filterable-attributes tool logic by fetching from the Meilisearch /filterable-attributes endpoint.async ({ indexUid }) => { try { const response = await apiClient.get(`/indexes/${indexUid}/settings/${endpoint}`); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); }
- src/tools/settings-tools.ts:152-154 (schema)Input schema definition for the get-filterable-attributes tool using Zod.{ indexUid: z.string().describe("Unique identifier of the index"), },
- src/tools/settings-tools.ts:147-166 (registration)Dynamic registration of the get-filterable-attributes tool via server.tool call in the loop over specificSettingsTools.// Create a tool for each specific setting specificSettingsTools.forEach(({ name, endpoint, description }) => { server.tool( name, description, { indexUid: z.string().describe("Unique identifier of the index"), }, async ({ indexUid }) => { try { const response = await apiClient.get(`/indexes/${indexUid}/settings/${endpoint}`); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } } ); });
- src/tools/settings-tools.ts:100-104 (registration)Configuration object in specificSettingsTools array that defines the get-filterable-attributes tool for registration.{ name: "get-filterable-attributes", endpoint: "filterable-attributes", description: "Get the filterable attributes setting", },
- src/index.ts:67-67 (registration)Invocation of registerSettingsTools which registers the get-filterable-attributes tool among others.registerSettingsTools(server);