get_recent_changes
Track regulatory updates by retrieving articles modified since a specified date, with change summaries and optional regulation filtering.
Instructions
List all articles that changed since a given date, with change summaries. Optionally filter to a specific regulation. Premium feature — requires Ansvar Intelligence Portal.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| regulation | No | Optional: filter to a specific regulation (e.g., "NIS2") | |
| since | Yes | ISO date (e.g., "2024-06-01") | |
| limit | No | Maximum results (default: 50, max: 200) |
Implementation Reference
- src/tools/version-tracking.ts:188-231 (handler)The implementation of the getRecentChanges tool logic, which queries the database for recent changes to articles.
export async function getRecentChanges( db: DatabaseAdapter, input: GetRecentChangesInput, ): Promise<{ since: string; changes: RecentChange[]; total: number } | { premium: false; message: string }> { if (!isPremiumEnabled()) { return { premium: false, message: PREMIUM_UPGRADE_MESSAGE }; } if (!(await hasVersionsTable(db))) { throw new Error('Version tracking data not available in this database build.'); } const { regulation, since, limit } = input; const effectiveLimit = Math.min(limit ?? 50, 200); let sql = ` SELECT a.regulation, a.article_number AS article, v.effective_date, v.change_summary, v.source_url FROM article_versions v JOIN articles a ON a.rowid = v.article_id WHERE v.effective_date >= $1 `; const params: (string | number)[] = [since]; if (regulation) { sql += ` AND a.regulation = $${params.length + 1}`; params.push(regulation); } sql += ` ORDER BY v.effective_date DESC LIMIT $${params.length + 1}`; params.push(effectiveLimit); const result = await db.query<RecentChange>(sql, params); return { since, changes: result.rows, total: result.rows.length, }; } - src/tools/version-tracking.ts:20-24 (schema)The interface definition for the input to getRecentChanges.
export interface GetRecentChangesInput { regulation?: string; since: string; limit?: number; } - src/tools/registry.ts:406-430 (registration)The MCP tool registration and invocation logic for 'get_recent_changes'.
name: 'get_recent_changes', description: 'List all articles that changed since a given date, with change summaries. Optionally filter to a specific regulation. Premium feature — requires Ansvar Intelligence Portal.', inputSchema: { type: 'object', properties: { regulation: { type: 'string', description: 'Optional: filter to a specific regulation (e.g., "NIS2")', }, since: { type: 'string', description: 'ISO date (e.g., "2024-06-01")', }, limit: { type: 'number', description: 'Maximum results (default: 50, max: 200)', }, }, required: ['since'], }, handler: async (db, args) => { const input = args as unknown as GetRecentChangesInput; return await getRecentChanges(db, input); },