card_cardsInfo
Retrieve detailed information for specific Anki flashcard IDs to access card data and review status.
Instructions
Returns a list of objects containing information for each card ID provided.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cards | Yes | A list of card IDs. |
Implementation Reference
- src/anki_mcp/__init__.py:25-25 (registration)Registers the card service tools with the 'card_' prefix (e.g., cardsInfo becomes card_cardsInfo).await anki_mcp.import_server("card", card_mcp)
- src/anki_mcp/card_service.py:23-30 (handler)The tool handler decorated with name='cardsInfo'. Defines the schema via decorator and parameters, and implements logic by proxying to AnkiConnect's 'cardsInfo' via anki_call.@card_mcp.tool( name="cardsInfo", description="Returns a list of objects containing information for each card ID provided.", ) async def get_cards_info_tool( cards: Annotated[List[int], Field(description="A list of card IDs.")], ) -> List[Dict[str, Any]]: return await anki_call("cardsInfo", cards=cards)
- src/anki_mcp/common.py:8-23 (helper)Shared helper function that performs the actual HTTP call to AnkiConnect API for all tools.async def anki_call(action: str, **params: Any) -> Any: async with httpx.AsyncClient() as client: payload = {"action": action, "version": 6, "params": params} result = await client.post(ANKICONNECT_URL, json=payload) result.raise_for_status() result_json = result.json() error = result_json.get("error") if error: raise Exception(f"AnkiConnect error for action '{action}': {error}") response = result_json.get("result") if "result" in result_json: return response return result_json