Skip to main content
Glama

card_cardsToNotes

Retrieve note IDs associated with specific card IDs in Anki decks using the tool linked to the anki-mcp server. Ideal for organizing and managing flashcard-based learning materials.

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

  • The handler function implementing the core logic of the 'card_cardsToNotes' tool. It takes a list of card IDs and returns the corresponding note IDs by delegating to AnkiConnect's 'cardsToNotes' action.
    @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)
  • Creation of the 'card_mcp' FastMCP server instance where the 'cardsToNotes' tool (prefixed as 'card_cardsToNotes') is registered.
    card_mcp = FastMCP(name="AnkiCardService")
  • Top-level registration of the 'card_mcp' service into the main 'anki_mcp' server, enabling the 'card_cardsToNotes' tool under the 'card_' prefix.
    await anki_mcp.import_server("card", card_mcp)
  • Shared helper function that makes asynchronous HTTP requests to the AnkiConnect API, invoked by the tool handler with action='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