get-displayed-attributes
Retrieve the displayed attributes configuration for a Meilisearch index to control which fields appear 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)Shared handler function for retrieving specific index settings, including 'displayed-attributes'. Calls Meilisearch API to get the setting value for the given indexUid.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:153-154 (schema)Input schema defining the required 'indexUid' parameter as a string.indexUid: z.string().describe("Unique identifier of the index"), },
- src/tools/settings-tools.ts:95-99 (registration)Configuration object that defines the tool's name, endpoint, and description for dynamic registration.{ name: "get-displayed-attributes", endpoint: "displayed-attributes", description: "Get the displayed attributes setting", },
- src/tools/settings-tools.ts:147-166 (registration)forEach loop that dynamically registers the server.tool for 'get-displayed-attributes' and other specific settings tools.// 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 registerSettingsTools which triggers the registration of the 'get-displayed-attributes' tool.registerSettingsTools(server);