get-ranking-rules
Retrieve the ranking rules configuration for a Meilisearch index to understand how search results are ordered.
Instructions
Get the ranking rules setting
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| indexUid | Yes | Unique identifier of the index |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"indexUid": {
"description": "Unique identifier of the index",
"type": "string"
}
},
"required": [
"indexUid"
],
"type": "object"
}
Implementation Reference
- src/tools/settings-tools.ts:155-164 (handler)Handler function that performs a GET request to the Meilisearch API for `/indexes/{indexUid}/settings/ranking-rules` (via ${endpoint}) and returns the JSON-formatted settings or error response.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)Zod input schema requiring 'indexUid' parameter as a string, describing the Meilisearch index unique identifier.{ indexUid: z.string().describe("Unique identifier of the index"), },
- src/tools/settings-tools.ts:149-165 (registration)Dynamic registration of the 'get-ranking-rules' tool (name, description, schema, and handler provided via loop variables from specificSettingsTools config).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:110-114 (registration)Configuration object in specificSettingsTools array that defines the tool name 'get-ranking-rules', its API endpoint 'ranking-rules', and description for use in dynamic registration.{ name: "get-ranking-rules", endpoint: "ranking-rules", description: "Get the ranking rules setting", },
- src/index.ts:67-67 (registration)Top-level invocation of registerSettingsTools on the MCP server instance, which triggers registration of get-ranking-rules and other settings tools.registerSettingsTools(server);