get-displayed-attributes
Retrieve the displayed attributes setting for a specific index in Meilisearch using the Model Context Protocol, enabling precise control over search result visibility and management.
Instructions
Get the displayed attributes setting
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| indexUid | Yes | Unique identifier of the index |
Implementation Reference
- src/tools/settings-tools.ts:95-98 (registration)Configuration object that defines the 'get-displayed-attributes' tool, specifying its name, the Meilisearch endpoint 'displayed-attributes', and description. This is used in the dynamic registration loop.{ name: "get-displayed-attributes", endpoint: "displayed-attributes", description: "Get the displayed attributes setting",
- src/tools/settings-tools.ts:155-164 (handler)Handler function for 'get-displayed-attributes' (shared with other specific settings getters). Fetches the displayed attributes from Meilisearch API endpoint `/indexes/${indexUid}/settings/displayed-attributes` and returns JSON stringified response.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 for 'get-displayed-attributes' tool using Zod: requires 'indexUid' string.{ indexUid: z.string().describe("Unique identifier of the index"), },
- src/tools/settings-tools.ts:147-166 (registration)forEach loop that registers the 'get-displayed-attributes' tool (and others) on the MCP server using the configuration from specificSettingsTools array.// 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/index.ts:67-67 (registration)Top-level registration call in main server setup that invokes registerSettingsTools, thereby registering 'get-displayed-attributes' among other settings tools.registerSettingsTools(server);