link_adrs
Establish relationships between Architecture Decision Records by linking them as related, conflicting, or dependent to create a clear dependency graph.
Instructions
Create a relationship between two ADRs: related_to, conflicts_with, or depends_on
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from_id | Yes | Source ADR ID | |
| to_id | Yes | Target ADR ID | |
| relation | Yes | Relationship type |
Implementation Reference
- index.js:194-207 (handler)The tool registration and handler implementation for 'link_adrs'. It validates the ADR IDs and calls the 'linkADRs' database helper function.
server.registerTool('link_adrs', { description: 'Create a relationship between two ADRs: related_to, conflicts_with, or depends_on', inputSchema: { from_id: z.number().describe('Source ADR ID'), to_id: z.number().describe('Target ADR ID'), relation: z.enum(['related_to', 'conflicts_with', 'depends_on']).describe('Relationship type'), }, }, async ({ from_id, to_id, relation }) => { if (!getADR(from_id)) throw new Error(`ADR ${from_id} not found`); if (!getADR(to_id)) throw new Error(`ADR ${to_id} not found`); linkADRs(from_id, to_id, relation); return { content: [{ type: 'text', text: `Linked: ADR-${from_id} ${relation.replace(/_/g, ' ')} ADR-${to_id}` }] }; }); - db.js:95-99 (handler)The database implementation of the 'linkADRs' function, which inserts a relationship record into the 'adr_relations' table.
export function linkADRs(from_id, to_id, relation) { db.prepare( 'INSERT OR IGNORE INTO adr_relations (from_id, to_id, relation) VALUES (?, ?, ?)' ).run(from_id, to_id, relation); }