Skip to main content
Glama
meilisearch

Meilisearch MCP Server

Official
by meilisearch

create-index

Generates a new Meilisearch index by specifying a unique identifier (uid) and optional primary key, enabling efficient data organization and search functionality.

Instructions

Create a new Meilisearch index

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
primaryKeyNo
uidYes

Implementation Reference

  • MCP tool handler for create-index: calls IndexManager.create_index with uid and optional primaryKey, returns success message with result.
    elif name == "create-index":
        result = self.meili_client.indexes.create_index(
            arguments["uid"], arguments.get("primaryKey")
        )
        return [
            types.TextContent(type="text", text=f"Created index: {result}")
        ]
  • Registration of the create-index tool in list_tools handler, including description and input schema requiring 'uid'.
    types.Tool(
        name="create-index",
        description="Create a new Meilisearch index",
        inputSchema={
            "type": "object",
            "properties": {
                "uid": {"type": "string"},
                "primaryKey": {"type": "string"},
            },
            "required": ["uid"],
            "additionalProperties": False,
        },
    ),
  • Input schema for create-index tool: object with required 'uid' string and optional 'primaryKey' string.
        "type": "object",
        "properties": {
            "uid": {"type": "string"},
            "primaryKey": {"type": "string"},
        },
        "required": ["uid"],
        "additionalProperties": False,
    },
  • IndexManager helper method wrapping Meilisearch Client.create_index for creating indexes.
    def create_index(
        self, uid: str, primary_key: Optional[str] = None
    ) -> Dict[str, Any]:
        """Create a new index"""
        try:
            return self.client.create_index(uid, {"primaryKey": primary_key})
        except Exception as e:
            raise Exception(f"Failed to create index: {str(e)}")

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related Tools

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/meilisearch/meilisearch-mcp'

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