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
| Name | Required | Description | Default |
|---|---|---|---|
| primaryKey | No | ||
| uid | Yes |
Implementation Reference
- src/meilisearch_mcp/server.py:487-493 (handler)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}") ]
- src/meilisearch_mcp/server.py:123-135 (registration)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, },
- src/meilisearch_mcp/indexes.py:20-27 (helper)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)}")