Skip to main content
Glama
devlimelabs

Meilisearch MCP Server

by devlimelabs

create-index

Generates a new Meilisearch index by specifying a unique identifier and optional primary key, enabling structured search functionality.

Instructions

Create a new Meilisearch index

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexUidYesUnique identifier for the new index
primaryKeyNoPrimary key for the index

Implementation Reference

  • The handler function that creates a new Meilisearch index by making a POST request to the /indexes endpoint using apiClient, returns the response as text content, and handles errors.
    async ({ indexUid, primaryKey }: CreateIndexParams) => { try { const response = await apiClient.post('/indexes', { uid: indexUid, primaryKey, }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } }
  • Input schema using Zod for validating parameters: indexUid (string, required), primaryKey (string, optional).
    { indexUid: z.string().describe('Unique identifier for the new index'), primaryKey: z.string().optional().describe('Primary key for the index'), },
  • Registers the 'create-index' tool on the MCP server with name, description, input schema, and handler function.
    server.tool( 'create-index', 'Create a new Meilisearch index', { indexUid: z.string().describe('Unique identifier for the new index'), primaryKey: z.string().optional().describe('Primary key for the index'), }, async ({ indexUid, primaryKey }: CreateIndexParams) => { try { const response = await apiClient.post('/indexes', { uid: indexUid, primaryKey, }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return createErrorResponse(error); } } );
  • TypeScript interface defining the input parameters for the create-index tool, used in the handler type annotation.
    interface CreateIndexParams { indexUid: string; primaryKey?: string; }
  • src/index.ts:64-64 (registration)
    Invokes registerIndexTools to register all index tools, including 'create-index', on the main MCP server instance.
    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