Skip to main content
Glama
devlimelabs

Meilisearch MCP Server

by devlimelabs

get-displayed-attributes

Retrieve the displayed attributes configuration for a Meilisearch index to control which fields appear in search results.

Instructions

Get the displayed attributes setting

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYesUnique identifier of the index

Implementation Reference

  • Shared handler function for retrieving specific index settings, including 'displayed-attributes'. Calls Meilisearch API to get the setting value for the given indexUid.
    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 defining the required 'indexUid' parameter as a string.
      indexUid: z.string().describe("Unique identifier of the index"),
    },
  • Configuration object that defines the tool's name, endpoint, and description for dynamic registration.
    {
      name: "get-displayed-attributes",
      endpoint: "displayed-attributes",
      description: "Get the displayed attributes setting",
    },
  • forEach loop that dynamically registers the server.tool for 'get-displayed-attributes' and other specific settings tools.
    // 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 registerSettingsTools which triggers the registration of the 'get-displayed-attributes' 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/devlimelabs/meilisearch-ts-mcp'

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