Skip to main content
Glama

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
NameRequiredDescriptionDefault
include_card_countsNo

Implementation Reference

  • 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))), }, ], }; } }, );
  • 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))), }, ], }; } },
  • 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), }),
  • 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, })), }; }

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/rangogamedev/codecks-mcp'

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