Skip to main content
Glama
devlimelabs

Meilisearch MCP Server

by devlimelabs

update-index

Modify the primary key of a Meilisearch index to enhance data organization and retrieval efficiency. Input includes the index identifier and the new primary key.

Instructions

Update a Meilisearch index (currently only supports updating the primary key)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYesUnique identifier of the index
primaryKeyYesNew primary key for the index

Implementation Reference

  • The handler function that executes the 'update-index' tool logic: patches the primary key of the Meilisearch index using apiClient and returns the response or error.
    async ({ indexUid, primaryKey }: UpdateIndexParams) => { try { const response = await apiClient.patch(`/indexes/${indexUid}`, { primaryKey, }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } }
  • Zod input schema for the 'update-index' tool parameters: indexUid and primaryKey.
    { indexUid: z.string().describe('Unique identifier of the index'), primaryKey: z.string().describe('New primary key for the index'), },
  • TypeScript interface defining the parameters for the update-index handler.
    interface UpdateIndexParams { indexUid: string; primaryKey: string; }
  • Direct registration of the 'update-index' tool on the MCP server within registerIndexTools.
    server.tool( 'update-index', 'Update a Meilisearch index (currently only supports updating the primary key)', { indexUid: z.string().describe('Unique identifier of the index'), primaryKey: z.string().describe('New primary key for the index'), }, async ({ indexUid, primaryKey }: UpdateIndexParams) => { try { const response = await apiClient.patch(`/indexes/${indexUid}`, { primaryKey, }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } } );
  • src/index.ts:64-64 (registration)
    Top-level call to registerIndexTools on the main MCP server instance, which includes the 'update-index' tool.
    registerIndexTools(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