Skip to main content
Glama

compare_requirements

Read-only

Compare regulatory requirements across multiple EU regulations on specific topics like incident reporting or risk assessment. Identifies matching articles with text snippets to show how different regulations address the same topic.

Instructions

Search and compare articles across multiple regulations on a specific topic. Returns matching articles from each regulation with text snippets showing how they address the topic. Uses full-text search with relevance ranking to find related requirements.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicYesTopic to compare (e.g., "incident reporting", "risk assessment")
regulationsYesRegulations to compare (e.g., ["DORA", "NIS2"])

Implementation Reference

  • The main implementation of the `compare_requirements` tool, which searches for regulations based on a topic and its synonyms, extracts timeline-related information, and returns a structured comparison.
    export async function compareRequirements(
      db: DatabaseAdapter,
      input: CompareInput
    ): Promise<CompareResult> {
      const { topic, regulations } = input;
    
      // Get synonym terms for expanded search
      const synonyms = getSynonyms(topic);
      const searchTerms = [topic, ...synonyms];
    
      const comparisons: RegulationComparison[] = [];
    
      for (const regulation of regulations) {
        // Search with original topic + synonym terms, then merge results
        const allResults: Map<string, { article: string; snippet: string; relevance: number }> = new Map();
    
        for (const term of searchTerms) {
          const results = await searchRegulations(db, {
            query: term,
            regulations: [regulation],
            limit: 5,
          });
    
          for (const result of results) {
            const existing = allResults.get(result.article);
            if (!existing || result.relevance > existing.relevance) {
              allResults.set(result.article, {
                article: result.article,
                snippet: result.snippet,
                relevance: result.relevance,
              });
            }
          }
        }
    
        // Sort by relevance and take top 5
        const mergedResults = Array.from(allResults.values())
          .sort((a, b) => b.relevance - a.relevance)
          .slice(0, 5);
    
        // Get full article text for timeline extraction
        const articles: string[] = [];
        const requirements: string[] = [];
        let combinedText = '';
    
        for (const result of mergedResults) {
          articles.push(result.article);
          requirements.push(result.snippet.replace(/>>>/g, '').replace(/<<</g, ''));
    
          // Get full text for timeline extraction
          const fullArticleResult = await db.query(
            `SELECT text FROM articles WHERE regulation = $1 AND article_number = $2`,
            [regulation, result.article]
          );
    
          if (fullArticleResult.rows.length > 0) {
            combinedText += ' ' + (fullArticleResult.rows[0] as { text: string }).text;
          }
        }
    
        const timelines = extractTimelines(combinedText);
    
        comparisons.push({
          regulation,
          requirements,
          articles,
          timelines,
        });
      }
    
      return {
        topic,
        regulations: comparisons,
      };
    }
  • Data structures for the `compare_requirements` tool input and output.
    export interface CompareInput {
      topic: string;
      regulations: string[];
    }
    
    export interface RegulationComparison {
      regulation: string;
      requirements: string[];
      articles: string[];
      timelines?: string;
    }
    
    export interface CompareResult {
      topic: string;
      regulations: RegulationComparison[];
    }
  • Tool registration for `compare_requirements` in the tool registry.
    {
      name: 'compare_requirements',
      description: 'Search and compare articles across multiple regulations on a specific topic. Returns matching articles from each regulation with text snippets showing how they address the topic. Uses full-text search with relevance ranking to find related requirements.',
      inputSchema: {
        type: 'object',
        properties: {
          topic: {
            type: 'string',
            description: 'Topic to compare (e.g., "incident reporting", "risk assessment")',
          },
          regulations: {
            type: 'array',
            items: { type: 'string' },
            description: 'Regulations to compare (e.g., ["DORA", "NIS2"])',
          },
        },
        required: ['topic', 'regulations'],
      },
      handler: async (db, args) => {
        const input = args as unknown as CompareInput;
        return await compareRequirements(db, input);
      },
    },
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds valuable behavioral details beyond annotations: discloses the search mechanism ('full-text search with relevance ranking') and return format ('text snippets showing how they address the topic'). Consistent with readOnlyHint=true. Does not contradict annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three tightly constructed sentences, each earning its place: (1) core purpose, (2) return value description, (3) search methodology. Front-loaded with the primary action and appropriately scoped for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple 2-parameter schema and presence of safety annotations, the description adequately explains the return values (matching articles with snippets) despite no output schema. Could mention pagination or result limits, but sufficiently complete for agent selection and invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with clear descriptions and examples for both parameters (topic and regulations). The description references these ('specific topic', 'multiple regulations') but does not add syntax or format details beyond what the schema already provides. Baseline 3 is appropriate given comprehensive schema documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description uses specific verbs ('Search and compare') and clearly identifies the resource ('articles across multiple regulations'). It distinguishes from siblings like get_article (single retrieval) and diff_article (specific article comparison) by emphasizing 'across multiple regulations' and 'specific topic'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear context about the specific use case (comparing requirements across regulations on a topic), which implicitly guides selection over single-regulation or single-article tools. Lacks explicit 'when not to use' or named sibling alternatives, but the functional scope is distinct enough to guide selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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