Skip to main content
Glama
OrionPotter

Meilisearch MCP Server

by OrionPotter

get-synonyms

Retrieve configured synonyms for a Meilisearch index to enhance search relevance by expanding query terms with equivalent words.

Instructions

Get the synonyms setting

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYesUnique identifier of the index

Implementation Reference

  • Handler function that performs a GET request to the Meilisearch API for the synonyms settings (/indexes/{indexUid}/settings/synonyms) and returns the JSON-formatted response or an error.
    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 using Zod: requires `indexUid` as a string, the unique identifier of the Meilisearch index.
    {
      indexUid: z.string().describe("Unique identifier of the index"),
    },
  • Configuration object in the `specificSettingsTools` array that specifies the tool name, API endpoint ('synonyms'), and description, used in the dynamic registration loop.
    {
      name: "get-synonyms",
      endpoint: "synonyms",
      description: "Get the synonyms setting",
    },
  • Dynamic registration loop using `server.tool()` for all specific settings tools, including get-synonyms, providing name, description, schema, and shared handler.
    // 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 invocation of `registerSettingsTools(server)` in the main MCP server setup, which registers the get-synonyms tool.
    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