get-sortable-attributes
Retrieve the sortable attributes configuration for a Meilisearch index to understand which fields can be used for sorting search results.
Instructions
Get the sortable 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)The handler function that executes the tool logic: fetches the sortable-attributes setting from Meilisearch API for the given index using the specific 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 defining the required indexUid parameter for the tool.{ indexUid: z.string().describe("Unique identifier of the index"), },
- src/tools/settings-tools.ts:149-165 (registration)The server.tool registration call that registers the 'get-sortable-attributes' tool dynamically via the loop using its name, description, schema, and handler.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:105-109 (helper)Helper configuration object in the specificSettingsTools array that provides the name, endpoint, and description for the get-sortable-attributes tool, used in the registration loop.{ name: "get-sortable-attributes", endpoint: "sortable-attributes", description: "Get the sortable attributes setting", },