list_decks
Retrieve all decks in Codecks project management. Optionally include card counts per deck to track project progress and organization.
Instructions
List all decks. Set include_card_counts=True for per-deck counts.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_card_counts | No |
Implementation Reference
- src/tools/read.ts:193-219 (registration)Tool registration for 'list_decks' - defines the schema (include_card_counts boolean parameter), metadata (title, description), and the handler that calls client.listDecks().server.registerTool( "list_decks", { title: "List Decks", description: "List all decks. Set include_card_counts=True for per-deck counts.", inputSchema: z.object({ include_card_counts: z.boolean().default(false), }), }, async (args) => { try { const result = await client.listDecks(args.include_card_counts); return { content: [{ type: "text", text: JSON.stringify(finalizeToolResult(result)) }], }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify(finalizeToolResult(handleError(err))), }, ], }; } }, );
- src/tools/read.ts:202-218 (handler)Handler function for list_decks tool - executes the tool logic by calling client.listDecks() with the include_card_counts argument, wraps result in finalizeToolResult, and handles errors.async (args) => { try { const result = await client.listDecks(args.include_card_counts); return { content: [{ type: "text", text: JSON.stringify(finalizeToolResult(result)) }], }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify(finalizeToolResult(handleError(err))), }, ], }; } },
- src/tools/read.ts:198-200 (schema)Input schema definition for list_decks tool - defines include_card_counts as an optional boolean parameter with default value false using zod validation.inputSchema: z.object({ include_card_counts: z.boolean().default(false), }),
- src/client.ts:198-212 (handler)Core implementation of listDecks method in CodecksClient - builds GraphQL-like query, fetches deck data with optional card counts, and transforms response to include card_count property.async listDecks(includeCardCounts = false): Promise<Record<string, unknown>> { const fields: unknown[] = ["id", "title"]; if (includeCardCounts) fields.push({ cards: ["id"] }); const result = await query({ _root: [{ account: [{ decks: fields }] }], }); const decks = this.extractList(result, "decks"); return { decks: decks.map((d) => ({ ...d, card_count: Array.isArray(d.cards) ? (d.cards as unknown[]).length : undefined, })), }; }