list-indexes
Retrieve all indexes from a Meilisearch server to manage and organize search data efficiently. Ideal for maintaining structured search environments.
Instructions
List all Meilisearch indexes
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/meilisearch_mcp/server.py:136-144 (registration)Registration of the 'list-indexes' tool in the list_tools handler, including its name, description, and input schema (empty object).types.Tool( name="list-indexes", description="List all Meilisearch indexes", inputSchema={ "type": "object", "properties": {}, "additionalProperties": False, }, ),
- src/meilisearch_mcp/server.py:495-504 (handler)The MCP tool handler for 'list-indexes' which retrieves indexes using the client and returns formatted JSON output.elif name == "list-indexes": indexes = self.meili_client.get_indexes() formatted_json = json.dumps( indexes, indent=2, default=json_serializer ) return [ types.TextContent( type="text", text=f"Indexes:\n{formatted_json}" ) ]
- Helper method in MeilisearchClient that fetches indexes from the Meilisearch library client and serializes them into a JSON-friendly dictionary format.def get_indexes(self) -> Dict[str, Any]: """Get all indexes""" indexes = self.client.get_indexes() # Convert Index objects to serializable dictionaries serialized_indexes = [] for index in indexes["results"]: serialized_indexes.append( { "uid": index.uid, "primaryKey": index.primary_key, "createdAt": index.created_at, "updatedAt": index.updated_at, } ) return { "results": serialized_indexes, "offset": indexes["offset"], "limit": indexes["limit"], "total": indexes["total"], }