list_projects
Retrieve all projects with deck information from Codecks to manage project workflows and track progress.
Instructions
List all projects with deck info.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/read.ts:221-245 (registration)Registration of the list_projects MCP tool with title 'List Projects', description 'List all projects with deck info.', and empty input schema. The handler calls client.listProjects() and returns the result as JSON content.server.registerTool( "list_projects", { title: "List Projects", description: "List all projects with deck info.", inputSchema: z.object({}), }, async () => { try { const result = await client.listProjects(); return { content: [{ type: "text", text: JSON.stringify(finalizeToolResult(result)) }], }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify(finalizeToolResult(handleError(err))), }, ], }; } }, );
- src/client.ts:216-225 (handler)Implementation of listProjects() method that queries the Codecks API for account projects with id, title, and deck info. Returns an object containing the projects list extracted using the extractList helper.async listProjects(): Promise<Record<string, unknown>> { const result = await query({ _root: [ { account: [{ projects: ["id", "title", { decks: ["id", "title"] }] }], }, ], }); return { projects: this.extractList(result, "projects") }; }
- src/tools/read.ts:226-226 (schema)Input schema definition for list_projects tool: z.object({}) - no parameters required.inputSchema: z.object({}),
- src/client.ts:671-685 (helper)The extractList() helper method that recursively searches through a nested result object to find and extract an array by key name. Used by listProjects to extract the projects array from the API response.private extractList(result: Record<string, unknown>, key: string): Record<string, unknown>[] { for (const val of Object.values(result)) { if (typeof val === "object" && val !== null) { const obj = val as Record<string, unknown>; if (Array.isArray(obj[key])) return obj[key] as Record<string, unknown>[]; for (const inner of Object.values(obj)) { if (typeof inner === "object" && inner !== null) { const innerObj = inner as Record<string, unknown>; if (Array.isArray(innerObj[key])) return innerObj[key] as Record<string, unknown>[]; } } } } return []; }