get_plan_summary
Retrieve a comprehensive summary with statistics for a specific plan, enabling AI agents to analyze project details and track progress efficiently.
Instructions
Get a comprehensive summary with statistics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| plan_id | Yes | Plan ID |
Implementation Reference
- src/tools.js:783-806 (handler)Main handler for the 'get_plan_summary' tool. Fetches the plan details and all nodes, computes comprehensive statistics using calculatePlanStatistics, and returns a formatted summary with progress percentage.if (name === "get_plan_summary") { const { plan_id } = args; const plan = await apiClient.plans.getPlan(plan_id); const nodes = await apiClient.nodes.getNodes(plan_id); // Calculate statistics const stats = calculatePlanStatistics(nodes); return formatResponse({ plan: { id: plan.id, title: plan.title, status: plan.status, description: plan.description, created_at: plan.created_at, updated_at: plan.updated_at }, statistics: stats, progress_percentage: stats.total > 0 ? ((stats.status_counts.completed / stats.total) * 100).toFixed(1) : 0 }); }
- src/tools.js:417-427 (registration)Tool registration in the ListToolsRequest handler, including name, description, and input schema.{ name: "get_plan_summary", description: "Get a comprehensive summary with statistics", inputSchema: { type: "object", properties: { plan_id: { type: "string", description: "Plan ID" } }, required: ["plan_id"] } }
- src/tools.js:941-993 (helper)Helper function to compute detailed statistics for a plan's nodes, recursively processing the hierarchy to count types, statuses, and list in-progress/blocked nodes. Called by the handler.function calculatePlanStatistics(nodes) { const stats = { total: 0, type_counts: { root: 0, phase: 0, task: 0, milestone: 0 }, status_counts: { not_started: 0, in_progress: 0, completed: 0, blocked: 0 }, in_progress_nodes: [], blocked_nodes: [] }; const processNode = (node) => { stats.total++; if (node.node_type && stats.type_counts[node.node_type] !== undefined) { stats.type_counts[node.node_type]++; } if (node.status && stats.status_counts[node.status] !== undefined) { stats.status_counts[node.status]++; if (node.status === 'in_progress') { stats.in_progress_nodes.push({ id: node.id, title: node.title, type: node.node_type }); } else if (node.status === 'blocked') { stats.blocked_nodes.push({ id: node.id, title: node.title, type: node.node_type }); } } if (node.children && node.children.length > 0) { node.children.forEach(processNode); } }; nodes.forEach(processNode); return stats; }