Skip to main content
Glama

get_new_cards

Retrieve a specified number of new, unseen flashcards from Anki for review or study sessions.

Instructions

Returns a given number (num) of new and unseen cards.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
numYesNumber of new cards to get

Implementation Reference

  • Handler function for the 'get_new_cards' tool within the CallToolRequestSchema. It parses the 'num' argument, fetches new cards using the helper findCardsAndOrder with query 'is:new', slices the first N cards, and returns them serialized as JSON text.
    case "get_new_cards": {
      const num = Number(args.num);
    
      const cards = await findCardsAndOrder("is:new");
    
      return {
        content: [{
          type: "text",
          text: JSON.stringify(cards.slice(0, num))
        }]
      };
    }
  • index.ts:206-218 (registration)
    Registration of the 'get_new_cards' tool in the ListToolsRequestSchema response, including the tool name, description, and input schema definition.
      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"]
      },
    }
  • Input schema definition for the 'get_new_cards' tool, specifying a required 'num' property of type number.
    inputSchema: {
      type: "object",
      properties: {
        num: {
          type: "number",
          description: "Number of new cards to get"
        }
      },
      required: ["num"]
    },
  • Helper function called by the get_new_cards handler to find cards matching the 'is:new' query, retrieve their details, clean the question and answer fields, and sort by due date.
    async function findCardsAndOrder(query: string): Promise<Card[]> {
      const cardIds = await client.card.findCards({
        query: formatQuery(query)
      });
      const cards: Card[] = (await client.card.cardsInfo({ cards: cardIds })).map(card => ({
        cardId: card.cardId,
        question: cleanWithRegex(card.question),
        answer: cleanWithRegex(card.answer),
        due: card.due
      })).sort((a: Card, b: Card) => a.due - b.due);
    
      return cards;
    }

Tool Definition Quality

Score is being calculated. Check back soon.

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/scorzeth/anki-mcp-server'

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