Skip to main content
Glama

update_cards

Mark Anki cards as answered and update their ease levels after review sessions to track learning progress.

Instructions

After the user answers cards you've quizzed them on, use this tool to mark them answered and update their ease

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
answersNo

Implementation Reference

  • The handler logic for the 'update_cards' tool within the CallToolRequestSchema handler. It processes the answers array, calls client.card.answerCards, handles success/failure, and returns a confirmation message.
    case "update_cards": {
      const answers = args.answers as { cardId: number; ease: number }[];
      const result = await client.card.answerCards({ answers: answers });
    
      const successfulCards = answers
        .filter((_, index) => result[index])
        .map(card => card.cardId);
      const failedCards = answers.filter((_, index) => !result[index]);
    
      if (failedCards.length > 0) {
        const failedCardIds = failedCards.map(card => card.cardId);
        throw new Error(`Failed to update cards with IDs: ${failedCardIds.join(', ')}`);
      }
    
      return {
        content: [{
          type: "text",
          text: `Updated cards ${successfulCards.join(", ")}`
        }]
      };
    }
  • The input schema and registration for the 'update_cards' tool defined in the ListToolsRequestSchema handler, specifying the expected 'answers' array with cardId and ease.
    {
      name: "update_cards",
      description: "After the user answers cards you've quizzed them on, use this tool to mark them answered and update their ease",
      inputSchema: {
        type: "object",
        properties: {
          answers: {
            type: "array",
            items: {
              type: "object",
              properties: {
                cardId: {
                  type: "number",
                  description: "Id of the card to answer"
                },
                ease: {
                  type: "number",
                  description: "Ease of the card between 1 (Again) and 4 (Easy)"
                }
              }
            }
          }
        },
      }
    },
  • index.ts:145-221 (registration)
    The tool registration occurs in the ListToolsRequestSchema handler where 'update_cards' is listed among available tools.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: "update_cards",
            description: "After the user answers cards you've quizzed them on, use this tool to mark them answered and update their ease",
            inputSchema: {
              type: "object",
              properties: {
                answers: {
                  type: "array",
                  items: {
                    type: "object",
                    properties: {
                      cardId: {
                        type: "number",
                        description: "Id of the card to answer"
                      },
                      ease: {
                        type: "number",
                        description: "Ease of the card between 1 (Again) and 4 (Easy)"
                      }
                    }
                  }
                }
              },
            }
          },
          {
            name: "add_card",
            description: "Create a new flashcard in Anki for the user. Must use HTML formatting only. IMPORTANT FORMATTING RULES:\n1. Must use HTML tags for ALL formatting - NO markdown\n2. Use <br> for ALL line breaks\n3. For code blocks, use <pre> with inline CSS styling\n4. Example formatting:\n   - Line breaks: <br>\n   - Code: <pre style=\"background-color: transparent; padding: 10px; border-radius: 5px;\">\n   - Lists: <ol> and <li> tags\n   - Bold: <strong>\n   - Italic: <em>",
            inputSchema: {
              type: "object",
              properties: {
                front: {
                  type: "string",
                  description: "The front of the card. Must use HTML formatting only."
                },
                back: {
                  type: "string",
                  description: "The back of the card. Must use HTML formatting only."
                }
              },
              required: ["front", "back"]
            }
          },
          {
            name: "get_due_cards",
            description: "Returns a given number (num) of cards due for review.",
            inputSchema: {
              type: "object",
              properties: {
                num: {
                  type: "number",
                  description: "Number of due cards to get"
                }
              },
              required: ["num"]
            },
          },
          {
            name: "get_new_cards",
            description: "Returns a given number (num) of new and unseen cards.",
            inputSchema: {
              type: "object",
              properties: {
                num: {
                  type: "number",
                  description: "Number of new cards to get"
                }
              },
              required: ["num"]
            },
          }
        ]
      };
    });

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.0.0

TDQS

A3.9/5.0
Behavior3/5

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

No annotations exist, so description bears full burden. It discloses that the tool marks answered and updates ease, but omits details like idempotency, side effects, or required permissions. Minimal but not misleading.

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?

Single sentence, front-loaded with action and condition. No redundant words. Efficiently conveys core functionality.

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

Completeness3/5

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

No output schema, so return value is unstated. The description covers the action but lacks information on result feedback or error conditions. Adequate for simple update but not fully comprehensive.

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?

Input schema already describes both parameters (cardId and ease with ease range). Description adds no additional meaning beyond what schema provides. With high schema coverage, baseline 3 is appropriate.

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

Purpose5/5

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

Description clearly states verb 'mark them answered and update their ease' targeting specific resource 'cards'. Distinguishes from siblings like add_card (add) and get_due_cards/get_new_cards (fetch) by focusing on post-answer update.

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

Usage Guidelines4/5

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

Explicitly states when to use: after user answers cards. Does not list when not to use or alternatives, but context with sibling tools implies purpose is unique. Slightly lacks exclusion guidance.

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

Deploy Server

Other Tools