list_projects
View all projects and their details (ID, initial prompt, task counts) in the MCP task queue system. Optional filters: open, pending_approval, completed, or all states.
Instructions
List all projects in the system and their basic information (ID, initial prompt, task counts), optionally filtered by state (open, pending_approval, completed, all).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| state | No | Filter projects by state. 'open' (any incomplete task), 'pending_approval' (any tasks awaiting approval), 'completed' (all tasks done and approved), or 'all' to skip filtering. |
Implementation Reference
- src/server/toolExecutors.ts:126-143 (handler)The tool executor (handler) for 'list_projects'. Validates the optional 'state' parameter and delegates execution to TaskManager.listProjects, returning the raw result data.const listProjectsToolExecutor: ToolExecutor = { name: "list_projects", async execute(taskManager, args) { // 1. Argument Validation const state = validateOptionalStateParam(args.state, [ "open", "pending_approval", "completed", "all", ]); // 2. Core Logic Execution const resultData = await taskManager.listProjects(state as any); // 3. Return raw success data return resultData; }, };
- src/server/TaskManager.ts:388-423 (helper)Core helper method in TaskManager that implements the listing logic: reloads data, filters projects by optional state, computes stats, and returns structured ListProjectsSuccessData.public async listProjects(state?: TaskState): Promise<ListProjectsSuccessData> { await this.ensureInitialized(); await this.reloadFromDisk(); if (state && !["all", "open", "completed", "pending_approval"].includes(state)) { throw new AppError(`Invalid state filter: ${state}`, AppErrorCode.InvalidState); } let filteredProjects = [...this.data.projects]; if (state && state !== "all") { filteredProjects = filteredProjects.filter((p) => { switch (state) { case "open": return !p.completed; case "completed": return p.completed; case "pending_approval": return !p.completed && p.tasks.every((t) => t.status === "done"); default: return true; } }); } return { message: `Current projects in the system:`, projects: filteredProjects.map((p) => ({ projectId: p.projectId, initialPrompt: p.initialPrompt, totalTasks: p.tasks.length, completedTasks: p.tasks.filter((t) => t.status === "done").length, approvedTasks: p.tasks.filter((t) => t.approved).length, })), }; }
- src/server/tools.ts:15-29 (schema)Tool definition including input schema for 'list_projects', specifying optional 'state' enum for filtering.const listProjectsTool: Tool = { name: "list_projects", description: "List all projects in the system and their basic information (ID, initial prompt, task counts), optionally filtered by state (open, pending_approval, completed, all).", inputSchema: { type: "object", properties: { state: { type: "string", enum: ["open", "pending_approval", "completed", "all"], description: "Filter projects by state. 'open' (any incomplete task), 'pending_approval' (any tasks awaiting approval), 'completed' (all tasks done and approved), or 'all' to skip filtering.", }, }, required: [], }, };
- src/types/response.ts:34-43 (schema)TypeScript interface defining the output structure returned by the list_projects tool.export interface ListProjectsSuccessData { message: string; projects: Array<{ projectId: string; initialPrompt: string; totalTasks: number; completedTasks: number; approvedTasks: number; }>; }
- src/server/toolExecutors.ts:144-144 (registration)Registers the listProjectsToolExecutor in the toolExecutorMap used by executeToolAndHandleErrors.toolExecutorMap.set(listProjectsToolExecutor.name, listProjectsToolExecutor);