generate_adr
Analyze a saved session to automatically generate an Architecture Decision Record (ADR) in markdown format, while checking for similar past decisions to prevent duplication.
Instructions
Analyze a saved session and auto-generate an ADR. Exports a markdown file and warns about similar past decisions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | Session ID |
Implementation Reference
- index.js:76-98 (handler)The handler function for the generate_adr tool. It processes a session, extracts ADR information (using AI or heuristic), checks for similarities, saves the ADR, and generates the output.
}, async ({ session_id }) => { const session = getSession(session_id); if (!session) throw new Error(`Session ${session_id} not found`); const adr = process.env.ANTHROPIC_API_KEY ? await extractADRWithAI(session.conversation) : extractADR(session.conversation); const similar = findSimilarADRs(adr.title, adr.decision); const adrId = saveADR({ session_id, ...adr }); const filepath = exportADRFile(adrId, adr, session_id); let output = adrMarkdown(adrId, adr, session_id) + `\n\n---\n_Exported to: ${filepath}_`; if (similar.length > 0) { const warn = similar .map(s => ` • ADR-${s.id} [${s.status}] "${s.title}" (${s.project}, ${s.created_at.slice(0, 10)})`) .join('\n'); output += `\n\n⚠️ Similar past decisions found:\n${warn}`; } return { content: [{ type: 'text', text: output }] }; }); - index.js:71-75 (registration)Registration of the generate_adr tool, including its description and input schema.
server.registerTool('generate_adr', { description: 'Analyze a saved session and auto-generate an ADR. Exports a markdown file and warns about similar past decisions.', inputSchema: { session_id: z.number().describe('Session ID'), },