reset-ranking-rules
Restore default ranking rules for a Meilisearch index to reset search result ordering.
Instructions
Reset the ranking rules setting to its default value
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| indexUid | Yes | Unique identifier of the index |
Implementation Reference
- src/tools/settings-tools.ts:320-329 (handler)Handler function that executes the reset-ranking-rules tool. It sends a DELETE request to the Meilisearch API at `/indexes/{indexUid}/settings/ranking-rules` (where endpoint='ranking-rules') to reset the ranking rules to default.try { const response = await apiClient.delete(`/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:317-319 (schema)Input schema validation using Zod for the reset-ranking-rules tool, specifying the required indexUid parameter.indexUid: z.string().describe("Unique identifier of the index"), }, async ({ indexUid }) => {
- src/tools/settings-tools.ts:274-278 (registration)Specific configuration object within the resetSettingsTools array that defines the name, endpoint, and description for registering the reset-ranking-rules tool.{ name: "reset-ranking-rules", endpoint: "ranking-rules", description: "Reset the ranking rules setting to its default value", },
- src/tools/settings-tools.ts:312-331 (registration)Registration code block: the forEach loop over resetSettingsTools that calls server.tool() to register each reset tool, including reset-ranking-rules, with its specific name, description, shared schema, and handler.resetSettingsTools.forEach(({ name, endpoint, description }) => { server.tool( name, description, { indexUid: z.string().describe("Unique identifier of the index"), }, async ({ indexUid }) => { try { const response = await apiClient.delete(`/indexes/${indexUid}/settings/${endpoint}`); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } } ); }); };