agentbay_session_resume
Retrieve completed steps, blockers, key decisions, and recent failures from a previous agent session to resume work with full context.
Instructions
Read handoff context from a previous agent session. Includes completed steps, blockers, key decisions, and recent failures.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID | |
| taskId | No |
Implementation Reference
- src/index.ts:552-581 (registration)Registration of the 'agentbay_session_resume' tool on the MCP server using server.tool().
// Tool 24: Session Resume server.tool( 'agentbay_session_resume', 'Read handoff context from a previous agent session. Includes completed steps, blockers, key decisions, and recent failures.', { projectId: z.string().describe('Project ID'), taskId: z.string().optional(), }, async ({ projectId, taskId }) => { const params = new URLSearchParams(); if (taskId) params.set('taskId', taskId); const data = await apiGet(`/api/v1/projects/${projectId}/activity/resume?${params.toString()}`); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; if (!data.handoff) return { content: [{ type: 'text' as const, text: 'No handoff context found.' }] }; const h = data.handoff; let text = `# Session Handoff from ${h.fromAgentName || h.fromAgent || 'previous agent'}\n`; text += `Handoff at: ${h.handoffAt}\n\n## Summary\n${h.summary}\n`; if (h.completedSteps?.length) text += `\n## Completed\n${h.completedSteps.map((s: string) => `- [x] ${s}`).join('\n')}\n`; if (h.nextSteps?.length) text += `\n## Next Steps\n${h.nextSteps.map((s: string, i: number) => `${i + 1}. ${s}`).join('\n')}\n`; if (h.blockers?.length) text += `\n## Blockers\n${h.blockers.map((b: any) => `- [${b.severity || 'MEDIUM'}] ${b.description}`).join('\n')}\n`; if (h.keyDecisions?.length) text += `\n## Key Decisions\n${h.keyDecisions.map((d: any) => `- **${d.decision}**: ${d.rationale}`).join('\n')}\n`; if (h.filesModified?.length) text += `\n## Files Modified\n${h.filesModified.map((f: string) => `- ${f}`).join('\n')}\n`; if (data.recentFailures?.length) { text += `\n## Recent Failures (Don't Repeat)\n`; text += data.recentFailures.map((f: any) => `- **${f.title}**: ${f.content.substring(0, 200)}`).join('\n') + '\n'; } return { content: [{ type: 'text' as const, text }] }; } ); - src/index.ts:555-559 (schema)Input schema definition using Zod: requires projectId (string), optional taskId (string).
'Read handoff context from a previous agent session. Includes completed steps, blockers, key decisions, and recent failures.', { projectId: z.string().describe('Project ID'), taskId: z.string().optional(), }, - src/index.ts:560-581 (handler)Handler function that calls GET /api/v1/projects/{projectId}/activity/resume, then formats the handoff context into readable text with summary, completed steps, next steps, blockers, key decisions, files modified, and recent failures.
async ({ projectId, taskId }) => { const params = new URLSearchParams(); if (taskId) params.set('taskId', taskId); const data = await apiGet(`/api/v1/projects/${projectId}/activity/resume?${params.toString()}`); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; if (!data.handoff) return { content: [{ type: 'text' as const, text: 'No handoff context found.' }] }; const h = data.handoff; let text = `# Session Handoff from ${h.fromAgentName || h.fromAgent || 'previous agent'}\n`; text += `Handoff at: ${h.handoffAt}\n\n## Summary\n${h.summary}\n`; if (h.completedSteps?.length) text += `\n## Completed\n${h.completedSteps.map((s: string) => `- [x] ${s}`).join('\n')}\n`; if (h.nextSteps?.length) text += `\n## Next Steps\n${h.nextSteps.map((s: string, i: number) => `${i + 1}. ${s}`).join('\n')}\n`; if (h.blockers?.length) text += `\n## Blockers\n${h.blockers.map((b: any) => `- [${b.severity || 'MEDIUM'}] ${b.description}`).join('\n')}\n`; if (h.keyDecisions?.length) text += `\n## Key Decisions\n${h.keyDecisions.map((d: any) => `- **${d.decision}**: ${d.rationale}`).join('\n')}\n`; if (h.filesModified?.length) text += `\n## Files Modified\n${h.filesModified.map((f: string) => `- ${f}`).join('\n')}\n`; if (data.recentFailures?.length) { text += `\n## Recent Failures (Don't Repeat)\n`; text += data.recentFailures.map((f: any) => `- **${f.title}**: ${f.content.substring(0, 200)}`).join('\n') + '\n'; } return { content: [{ type: 'text' as const, text }] }; } );