Skip to main content
Glama

card_cardsToNotes

Convert Anki card IDs to their corresponding note IDs to manage flashcards and review content efficiently.

Instructions

Returns an unordered array of note IDs for the given card IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cardsYesA list of card IDs.

Implementation Reference

  • Handler function that executes the tool logic: converts a list of card IDs to their corresponding note IDs by calling the AnkiConnect `cardsToNotes` API.
    @card_mcp.tool( name="cardsToNotes", description="Returns an unordered array of note IDs for the given card IDs.", ) async def convert_cards_to_notes_tool( cards: Annotated[List[int], Field(description="A list of card IDs.")], ) -> List[int]: return await anki_call("cardsToNotes", cards=cards)
  • Top-level registration of the card service into the main MCP server with 'card' prefix, resulting in the tool name 'card_cardsToNotes'.
    await anki_mcp.import_server("card", card_mcp)
  • Pydantic-based input schema (Annotated[List[int]]) and output type (List[int]) defined in the tool decorator.
    @card_mcp.tool( name="cardsToNotes", description="Returns an unordered array of note IDs for the given card IDs.", ) async def convert_cards_to_notes_tool( cards: Annotated[List[int], Field(description="A list of card IDs.")], ) -> List[int]: return await anki_call("cardsToNotes", cards=cards)
  • Utility function `anki_call` that performs HTTP POST to AnkiConnect API, used by the handler to invoke 'cardsToNotes'.
    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

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