get-documents
Retrieve documents from a specified Meilisearch index using indexUid, with optional offset and limit parameters for precise data extraction.
Instructions
Get documents from an index
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| indexUid | Yes | ||
| limit | No | ||
| offset | No |
Implementation Reference
- src/meilisearch_mcp/server.py:515-532 (handler)Handler function for the 'get-documents' tool within the MCP tool dispatcher. Fetches documents from the specified index using MeilisearchClient, applies default offset/limit, serializes to JSON, and returns as text content.elif name == "get-documents": # Use default values to fix None parameter issues (related to issue #17) offset = arguments.get("offset", 0) limit = arguments.get("limit", 20) documents = self.meili_client.documents.get_documents( arguments["indexUid"], offset, limit, ) # Convert DocumentsResults object to proper JSON format (fixes issue #16) formatted_json = json.dumps( documents, indent=2, default=json_serializer ) return [ types.TextContent( type="text", text=f"Documents:\n{formatted_json}" ) ]
- src/meilisearch_mcp/server.py:155-168 (registration)Registration of the 'get-documents' tool in the list_tools handler, including name, description, and input schema definition.types.Tool( name="get-documents", description="Get documents from an index", inputSchema={ "type": "object", "properties": { "indexUid": {"type": "string"}, "offset": {"type": "integer"}, "limit": {"type": "integer"}, }, "required": ["indexUid"], "additionalProperties": False, }, ),
- Input schema for the 'get-documents' tool, defining required indexUid and optional offset/limit parameters."type": "object", "properties": { "indexUid": {"type": "string"}, "offset": {"type": "integer"}, "limit": {"type": "integer"}, }, "required": ["indexUid"], "additionalProperties": False, },