Skip to main content
Glama

card_suspended

Check if a specific Anki flashcard is suspended by its ID to verify study status and manage card visibility.

Instructions

Checks if a single card is suspended by its ID. Returns true if suspended, false otherwise.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cardYesThe ID of the card.

Implementation Reference

  • Handler for the 'suspended' tool (prefixed to 'card_suspended' by the main server). Calls AnkiConnect's 'suspended' action to check if a card is suspended.
    @card_mcp.tool(
        name="suspended",
        description="Checks if a single card is suspended by its ID. Returns true if suspended, false otherwise.",
    )
    async def check_card_suspended_tool(
        card: Annotated[int, Field(description="The ID of the card.")],
    ) -> bool:
        return await anki_call("suspended", card=card)
  • Registers the card_mcp tools with 'card' prefix in the main AnkiMCP server, making 'suspended' available as 'card_suspended'.
    await anki_mcp.import_server("card", card_mcp)
  • Common helper function used by all tool handlers to invoke AnkiConnect API endpoints via HTTP POST.
    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                                                                        
  • Creates the FastMCP instance for card-related tools, where individual tools like 'suspended' are registered via decorators.
    card_mcp = FastMCP(name="AnkiCardService")

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ujisati/anki-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server