UNPKG

@ankimcp/anki-mcp-server

Version:

Model Context Protocol server for Anki - enables AI assistants to interact with your Anki flashcards

32 lines • 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CARD_STATE_QUERY_FILTERS = void 0; exports.parseToolResult = parseToolResult; exports.findCardsFor = findCardsFor; function parseToolResult(result) { if (result?.content?.[0]?.text) { return JSON.parse(result.content[0].text); } return result; } exports.CARD_STATE_QUERY_FILTERS = [ "is:new -is:suspended -is:buried", "is:learn -is:suspended -is:buried", "is:review -is:learn -is:suspended -is:buried", "is:suspended", "is:buried", ]; function findCardsFor(query, allCardIds, states = {}) { const byState = [ states.new, states.learning, states.review, states.suspended, states.buried, ]; const index = exports.CARD_STATE_QUERY_FILTERS.findIndex((filter) => query === filter || query.endsWith(` ${filter}`)); if (index === -1) return allCardIds; return byState[index] ?? []; } //# sourceMappingURL=test-helpers.js.map