Skip to main content
Glama

diff_article

Compare EU regulation article versions between dates to identify changes with unified diffs and AI-generated summaries. Requires Ansvar Intelligence Portal.

Instructions

Show what changed in a specific article between two dates, including a unified diff and AI-generated change summary. Premium feature — requires Ansvar Intelligence Portal.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regulationYesRegulation ID (e.g., "NIS2", "DORA", "GDPR")
articleYesArticle number (e.g., "21", "6")
from_dateYesISO date to diff from (e.g., "2024-01-01")
to_dateNoISO date to diff to (defaults to today)

Implementation Reference

  • The handler implementation for diff_article tool.
    export async function diffArticle(
      db: DatabaseAdapter,
      input: DiffArticleInput,
    ): Promise<ArticleDiff | { 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, article, from_date, to_date } = input;
      const effectiveToDate = to_date ?? new Date().toISOString().slice(0, 10);
    
      const articleResult = await db.query<{ rowid: number }>(
        'SELECT rowid FROM articles WHERE regulation = $1 AND article_number = $2',
        [regulation, article],
      );
    
      if (articleResult.rows.length === 0) {
        throw new Error(`Article ${article} not found in ${regulation}`);
      }
    
      const articleId = articleResult.rows[0].rowid;
    
      // Find the version closest to the to_date that has a diff
      const diffResult = await db.query<{
        diff_from_previous: string | null;
        change_summary: string | null;
        effective_date: string | null;
      }>(
        `SELECT diff_from_previous, change_summary, effective_date
         FROM article_versions
         WHERE article_id = $1
           AND effective_date > $2
           AND effective_date <= $3
         ORDER BY effective_date DESC
         LIMIT 1`,
        [articleId, from_date, effectiveToDate],
      );
    
      if (diffResult.rows.length === 0) {
        return {
          regulation,
          article,
          from_date,
          to_date: effectiveToDate,
          diff: null,
          change_summary: 'No changes found in this date range.',
        };
      }
    
      const row = diffResult.rows[0];
      return {
        regulation,
        article,
        from_date,
        to_date: effectiveToDate,
        diff: row.diff_from_previous,
        change_summary: row.change_summary,
      };
    }
  • Input schema definition for diff_article.
    export interface DiffArticleInput {
      regulation: string;
      article: string;
      from_date: string;
      to_date?: string;
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Ansvar-Systems/eu-regulations'

If you have feedback or need assistance with the MCP directory API, please join our Discord server