Skip to main content
Glama

getReviewQueue

Retrieve Anki flashcards due for review with options to filter by deck, card type, and quantity for efficient study management.

Instructions

Get cards due for review with filtering options

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deckIdNoOptional deck ID to filter cards
includeLearningNoInclude learning cards
includeNewNoInclude new cards
includeReviewNoInclude review cards
limitNoMaximum number of cards to return

Implementation Reference

  • Handler function that builds query parameters from args and fetches the review queue from the Anki API endpoint '/api/v1/study/queue'.
    execute: async args => { try { const queryParams: Record<string, boolean | number | string> = {}; if (args.deckId !== undefined) queryParams.deckId = args.deckId; if (args.includeLearning !== undefined) queryParams.includeLearning = args.includeLearning; if (args.includeNew !== undefined) queryParams.includeNew = args.includeNew; if (args.includeReview !== undefined) queryParams.includeReview = args.includeReview; if (args.limit !== undefined) queryParams.limit = args.limit; const data = await ankiApiRequest( 'GET', '/api/v1/study/queue', undefined, queryParams, ); return JSON.stringify(data, null, 2); } catch (error) { return `Error: ${error instanceof Error ? error.message : String(error)}`; } },
  • Zod schema defining optional input parameters for filtering the review queue.
    parameters: z.object({ deckId: z.string().optional().describe('Optional deck ID to filter cards'), includeLearning: z.boolean().optional().describe('Include learning cards'), includeNew: z.boolean().optional().describe('Include new cards'), includeReview: z.boolean().optional().describe('Include review cards'), limit: z.number().optional().describe('Maximum number of cards to return'), }),
  • src/index.ts:224-257 (registration)
    Full registration of the 'getReviewQueue' tool with name, description, handler, and schema using server.addTool.
    server.addTool({ description: 'Get cards due for review with filtering options', execute: async args => { try { const queryParams: Record<string, boolean | number | string> = {}; if (args.deckId !== undefined) queryParams.deckId = args.deckId; if (args.includeLearning !== undefined) queryParams.includeLearning = args.includeLearning; if (args.includeNew !== undefined) queryParams.includeNew = args.includeNew; if (args.includeReview !== undefined) queryParams.includeReview = args.includeReview; if (args.limit !== undefined) queryParams.limit = args.limit; const data = await ankiApiRequest( 'GET', '/api/v1/study/queue', undefined, queryParams, ); return JSON.stringify(data, null, 2); } catch (error) { return `Error: ${error instanceof Error ? error.message : String(error)}`; } }, name: 'getReviewQueue', parameters: z.object({ deckId: z.string().optional().describe('Optional deck ID to filter cards'), includeLearning: z.boolean().optional().describe('Include learning cards'), includeNew: z.boolean().optional().describe('Include new cards'), includeReview: z.boolean().optional().describe('Include review cards'), limit: z.number().optional().describe('Maximum number of cards to return'), }), });
  • Shared helper function used by getReviewQueue (and other tools) to make authenticated API requests to the Anki server.
    async function ankiApiRequest( method: string, endpoint: string, body?: Record<string, unknown>, queryParams?: Record<string, boolean | number | string | undefined>, ) { const url = new URL(`${ANKI_BASE_URL}${endpoint}`); // Add query parameters if provided if (queryParams) { Object.entries(queryParams).forEach(([key, value]) => { if (value !== undefined && value !== '') { url.searchParams.append(key, String(value)); } }); } const options: RequestInit = { headers: { Authorization: `Bearer ${ANKI_API_KEY}`, 'Content-Type': 'application/json', }, method, }; if (body && method !== 'GET') { options.body = JSON.stringify(body); } const response = await fetch(url.toString(), options); const data = (await response.json()) as unknown; if (!response.ok) { const errorData = data as { error?: { message?: string } }; throw new Error( errorData.error?.message || `API request failed: ${response.statusText}`, ); } return data; }

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

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