get-cards-reviewed
Track daily card review progress using the Anki MCP Server tool. Retrieve detailed insights into the number of cards reviewed per day to monitor learning and retention effectively.
Instructions
Get the number of cards reviewed by day
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The async handler function for the 'get-cards-reviewed' tool. It fetches daily card review counts from Anki via make_anki_request, formats them into readable text, and returns as TextContent.async def get_cards_reviewed() -> list[types.TextContent]: result = await make_anki_request("getNumCardsReviewedByDay") if result["success"]: review_data = result["result"] # Format the review data for better readability formatted_data = "\n".join([f"{day}: {count} cards" for day, count in review_data]) return [ types.TextContent( type="text", text=f"Cards reviewed by day:\n{formatted_data}", ) ] else: return [ types.TextContent( type="text", text=f"Failed to retrieve review statistics: {result['error']}", ) ]
- src/anki_mcp/server.py:13-13 (registration)Registers the 'get-cards-reviewed' tool with the FastMCP app instance, associating it with the get_cards_reviewed handler.app.tool(name="get-cards-reviewed", description="Get the number of cards reviewed by day")(get_cards_reviewed)
- src/anki_mcp/tools/utils.py:10-33 (helper)Utility function used by the handler to send HTTP requests to Anki Connect API and handle responses/errors.async def make_anki_request(action: str, **params) -> Dict[str, Any]: """Make a request to the Anki Connect API with proper error handling.""" request_data = { "action": action, "version": ANKI_CONNECT_VERSION } if params: request_data["params"] = params async with httpx.AsyncClient() as client: try: response = await client.post(ANKI_CONNECT_URL, json=request_data, timeout=30.0) response.raise_for_status() result = response.json() # Anki Connect returns an object with either a result or error field if "error" in result and result["error"]: return {"success": False, "error": result["error"]} return {"success": True, "result": result.get("result")} except Exception as e: return {"success": False, "error": str(e)}