update-displayed-attributes
Modify the displayed attributes setting in Meilisearch by specifying the index identifier and JSON value, enabling precise control over visible fields in search results.
Instructions
Update the displayed attributes setting
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| indexUid | Yes | Unique identifier of the index | |
| value | Yes | JSON value for the setting |
Implementation Reference
- src/tools/settings-tools.ts:236-248 (handler)Shared handler function for updating specific settings, including 'update-displayed-attributes'. Parses the JSON value and sends a PUT request to the Meilisearch API endpoint /indexes/{indexUid}/settings/displayed-attributes.async ({ indexUid, value }) => { try { // Parse the value string to ensure it's valid JSON const parsedValue = JSON.parse(value); const response = await apiClient.put(`/indexes/${indexUid}/settings/${endpoint}`, parsedValue); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } }
- src/tools/settings-tools.ts:232-235 (schema)Input schema using Zod: indexUid (string) and value (string containing JSON for the new setting value).{ indexUid: z.string().describe("Unique identifier of the index"), value: z.string().describe("JSON value for the setting"), },
- src/tools/settings-tools.ts:175-179 (registration)Configuration object in updateSettingsTools array that defines the tool name, endpoint, and description, used in the forEach loop to register the tool via server.tool().{ name: "update-displayed-attributes", endpoint: "displayed-attributes", description: "Update the displayed attributes setting", },