Skip to main content
Glama
OrionPotter

Meilisearch MCP Server

by OrionPotter

get-displayed-attributes

Retrieve the displayed attributes configuration for a Meilisearch index to understand which fields are visible in search results.

Instructions

Get the displayed attributes setting

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYesUnique identifier of the index

Implementation Reference

  • Handler function that implements the core logic of the 'get-displayed-attributes' tool. It fetches the setting from Meilisearch API endpoint `/indexes/${indexUid}/settings/displayed-attributes` (endpoint resolved from config) and returns formatted JSON response or 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 validation using Zod for the tool's parameter: indexUid (string).
    {
      indexUid: z.string().describe("Unique identifier of the index"),
    },
  • Configuration object used in the dynamic registration loop to define the tool name, API endpoint, and description for 'get-displayed-attributes'.
    {
      name: "get-displayed-attributes",
      endpoint: "displayed-attributes",
      description: "Get the displayed attributes setting",
    },
  • Dynamic registration code that creates and registers the 'get-displayed-attributes' tool (and other get-* tools) with the MCP server using server.tool().
    // 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-displayed-attributes', with the main 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