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                                                                        
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the return type but lacks critical behavioral details such as error handling, rate limits, authentication needs, or what happens if card IDs are invalid. This is inadequate for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete. It doesn't explain the return format beyond 'unordered array of note IDs', missing details like structure or error cases. For a tool with rich sibling context and no structured support, more completeness is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents the 'cards' parameter. The description adds no additional meaning beyond implying the mapping from cards to notes, but doesn't clarify semantics like format or constraints. Baseline 3 is appropriate as the schema handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Returns') and the resource ('unordered array of note IDs for the given card IDs'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'note_findNotes' or 'note_notesInfo', which also deal with notes, so it misses full sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context for use, or compare to siblings like 'card_cardsInfo' or 'note_findNotes', leaving the agent with no usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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