Skip to main content
Glama
OrionPotter

Meilisearch MCP Server

by OrionPotter

reset-distinct-attribute

Reset the distinct attribute to its default value in a Meilisearch index to restore standard search behavior.

Instructions

Reset the distinct attribute setting to its default value

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYesUnique identifier of the index

Implementation Reference

  • Handler function that resets the distinct-attribute setting by sending a DELETE request to the Meilisearch API endpoint `/indexes/${indexUid}/settings/distinct-attribute`. Uses the `endpoint` variable set to 'distinct-attribute' from the tool definition.
    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);
      }
    }
  • Input schema for the reset-distinct-attribute tool, requiring the indexUid parameter.
    {
      indexUid: z.string().describe("Unique identifier of the index"),
    },
  • Tool registration entry in the resetSettingsTools array, defining the name, endpoint ('distinct-attribute'), and description. This entry triggers the registration via the subsequent forEach loop.
    {
      name: "reset-distinct-attribute",
      endpoint: "distinct-attribute",
      description: "Reset the distinct attribute setting to its default value",
    },
  • The forEach loop that registers the reset-distinct-attribute tool (and others) by calling server.tool with the name, description, schema, and handler derived from the array entry.
    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);
          }
        }
      );
    });

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