Skip to main content
Glama

get_article

Read-only

Retrieve specific article text from EU regulations like GDPR or AI Act. Use after search_regulations to access full legal content with optional recitals.

Instructions

Retrieve the full text of a specific article from a regulation. WARNING: Token usage varies (500-70,000 tokens per article). Large articles are automatically truncated at 50,000 characters (~12,500 tokens) with a notice. Use search_regulations first to find relevant articles.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regulationYesRegulation ID (e.g., "GDPR", "NIS2", "DORA")
articleYesArticle number (e.g., "17", "23")
include_recitalsNoOptional: include related recitals alongside the article text (default: false)

Implementation Reference

  • The core 'getArticle' function that executes the database query to retrieve an article.
    export async function getArticle(
      db: DatabaseAdapter,
      input: GetArticleInput
    ): Promise<Article | null> {
      const { regulation, article } = input;
    
      const sql = `
        SELECT
          regulation,
          article_number,
          title,
          text,
          chapter,
          recitals,
          cross_references
        FROM articles
        WHERE regulation = $1 AND article_number = $2
      `;
    
      const result = await db.query(sql, [regulation, article]);
    
      if (result.rows.length === 0) {
        return null;
      }
    
      const row = result.rows[0] as {
        regulation: string;
        article_number: string;
        title: string | null;
        text: string;
        chapter: string | null;
        recitals: string | null;
        cross_references: string | null;
      };
    
      // Token management: Truncate very large articles to prevent context overflow
      const MAX_CHARS = 50000; // ~12,500 tokens (safe for 200k context window)
      const originalLength = row.text.length;
      const tokenEstimate = Math.ceil(originalLength / 4); // ~4 chars per token
      let text = row.text;
      let truncated = false;
    
      if (originalLength > MAX_CHARS) {
        text = row.text.substring(0, MAX_CHARS) + '\n\n[... Article truncated due to length. Original: ' + originalLength + ' chars (~' + tokenEstimate + ' tokens). Use search_regulations to find specific sections.]';
        truncated = true;
      }
    
      return {
        regulation: row.regulation,
        article_number: row.article_number,
        title: row.title,
        text,
        chapter: row.chapter,
        recitals: row.recitals ? JSON.parse(row.recitals) : null,
        cross_references: row.cross_references ? JSON.parse(row.cross_references) : null,
        truncated,
        original_length: truncated ? originalLength : undefined,
        token_estimate: truncated ? tokenEstimate : undefined,
      };
    }
  • The input interface defining the parameters for the get_article tool.
    export interface GetArticleInput {
      regulation: string;
      article: string;
      include_recitals?: boolean;
    }
  • The registration of the 'get_article' tool in the central registry, including its description, input schema, and handler wrapper.
    {
      name: 'get_article',
      description: 'Retrieve the full text of a specific article from a regulation. WARNING: Token usage varies (500-70,000 tokens per article). Large articles are automatically truncated at 50,000 characters (~12,500 tokens) with a notice. Use search_regulations first to find relevant articles.',
      inputSchema: {
        type: 'object',
        properties: {
          regulation: {
            type: 'string',
            description: 'Regulation ID (e.g., "GDPR", "NIS2", "DORA")',
          },
          article: {
            type: 'string',
            description: 'Article number (e.g., "17", "23")',
          },
          include_recitals: {
            type: 'boolean',
            description: 'Optional: include related recitals alongside the article text (default: false)',
          },
        },
        required: ['regulation', 'article'],
      },
      handler: async (db, args) => {
        const input = args as unknown as GetArticleInput;
        const article = await getArticle(db, input);
        if (!article) {
          throw new Error(`Article ${input.article} not found in ${input.regulation}`);
        }
        return article;
      },
    },
Behavior4/5

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

While annotations declare the operation read-only/safe, the description adds critical behavioral context: variable token costs (500-70,000), automatic truncation thresholds (50,000 characters), and notification behavior when truncation occurs—essential for agent resource management.

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 sentences total, each earning its place: purpose declaration, cost/limit warning, and workflow prerequisite. No redundancy or filler; information density is high with critical constraints front-loaded.

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 complexity of retrieving large legal texts, the description adequately covers cost risks, size limits, and prerequisites. Minor gap: does not explicitly describe the output format/structure (e.g., markdown vs JSON), though truncation behavior implies text content.

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?

With 100% schema description coverage, the parameters (regulation ID, article number, include_recitals) are fully documented in the schema. The description aligns with these ('specific article from a regulation') but does not add syntax details beyond the schema, warranting the baseline score.

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?

The description opens with a specific verb ('Retrieve') and clear resource ('full text of a specific article from a regulation'), immediately distinguishing it from siblings like search_regulations or get_recital.

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

Usage Guidelines5/5

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

Explicitly prescribes a workflow ('Use search_regulations first to find relevant articles'), providing clear guidance on when to use this tool versus its search counterpart, and warns about token costs that would influence invocation decisions.

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