get-displayed-attributes
Retrieve the displayed attributes configuration for a Meilisearch index to understand which fields are visible in search results.
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:155-164 (handler)Handler function that implements the core logic of the 'get-displayed-attributes' tool. It fetches the setting from Meilisearch API endpoint `/indexes/${indexUid}/settings/displayed-attributes` (endpoint resolved from config) and returns formatted JSON response or error.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 validation using Zod for the tool's parameter: indexUid (string).{ indexUid: z.string().describe("Unique identifier of the index"), },
- src/tools/settings-tools.ts:95-99 (registration)Configuration object used in the dynamic registration loop to define the tool name, API endpoint, and description for 'get-displayed-attributes'.{ name: "get-displayed-attributes", endpoint: "displayed-attributes", description: "Get the displayed attributes setting", },
- src/tools/settings-tools.ts:147-166 (registration)Dynamic registration code that creates and registers the 'get-displayed-attributes' tool (and other get-* tools) with the MCP server using server.tool().// 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 call to register all settings tools, including 'get-displayed-attributes', with the main MCP server instance.registerSettingsTools(server);