Skip to main content
Glama
OrionPotter

Meilisearch MCP Server

by OrionPotter

get-ranking-rules

Retrieve the ranking rules configuration for a Meilisearch index to understand how search results are prioritized and sorted.

Instructions

Get the ranking rules setting

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYesUnique identifier of the index

Implementation Reference

  • Handler function implementing the core logic of the 'get-ranking-rules' tool. It makes an API call to retrieve the ranking-rules settings from Meilisearch for the specified index using the endpoint 'ranking-rules'.
    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);
      }
    }
  • Input schema definition for the 'get-ranking-rules' tool, validating the required 'indexUid' parameter using Zod.
    {
      indexUid: z.string().describe("Unique identifier of the index"),
    },
  • Configuration object used in the dynamic registration process for the 'get-ranking-rules' tool, specifying its name, API endpoint segment, and description.
    {
      name: "get-ranking-rules",
      endpoint: "ranking-rules",
      description: "Get the ranking rules setting",
    },
  • Dynamic registration loop that registers the 'get-ranking-rules' tool (and other settings getters) on the MCP server using the configuration objects and shared schema/handler template.
    // Create a tool for each specific setting
    specificSettingsTools.forEach(({ name, endpoint, description }) => {
      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/index.ts:67-67 (registration)
    Top-level call to register all settings tools, including 'get-ranking-rules', on the MCP server instance.
    registerSettingsTools(server);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/OrionPotter/iflow-mcp_meilisearch-ts-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server