get-sortable-attributes
Retrieve sortable attributes from a Meilisearch index to configure search result ordering options.
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 get-sortable-attributes tool. It retrieves the sortable attributes setting from the Meilisearch API for the specified index using the 'sortable-attributes' endpoint and returns the result as formatted JSON.
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)The input schema for the get-sortable-attributes tool, defining the required 'indexUid' parameter.
{ indexUid: z.string().describe("Unique identifier of the index"), }, - src/tools/settings-tools.ts:105-109 (registration)The configuration object used to dynamically register the get-sortable-attributes tool in the specificSettingsTools array, which is processed by a forEach loop to call server.tool for each tool.
{ name: "get-sortable-attributes", endpoint: "sortable-attributes", description: "Get the sortable attributes setting", }, - src/index.ts:67-67 (registration)Top-level call to registerSettingsTools, which in turn registers the get-sortable-attributes tool (among others) with the MCP server.
registerSettingsTools(server);