Skip to main content
Glama
metaneutrons

German Legal MCP Server

by metaneutrons

rii:get_decision

Retrieve full-text German court decisions with metadata by document ID. Supports federal and Bavarian sources, returns Markdown format with court details, dates, and file numbers.

Instructions

Retrieve full text of a court decision by doc ID. Returns decision in Markdown format with metadata (court, date, file number, ECLI). Use source "BY" for IDs from gesetze-bayern.de (format: Y-300-Z-...).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
doc_idYesDocument ID from search results (e.g., "jb-KORE704442026" for BUND, "Y-300-Z-GRURRS-B-2021-N-55699" for BY)
partYesK = Kurztext (summary), L = Langtext (full text, default). Only for source "BUND".L
save_pathNoSave full document to this file path instead of returning content. Returns metadata only.
sourceYesSource: "BUND" (federal, default) or "BY" (Bavarian state courts)BUND
sectionNoSection heading or "lines:100-200". Only for source "BY".

Implementation Reference

  • Handler for federal (BUND) decisions.
    private async handleGetDecision(args: Record<string, unknown>): Promise<ToolResult> {
      const { doc_id, part = 'L', save_path } = args as { doc_id: string; part?: string; save_path?: string };
    
      logger.info('Fetching decision', { doc_id, part });
    
      const response = await axios.get(BASE_URL, {
        params: { 'doc.id': doc_id, 'doc.part': part, showdoccase: '1', paramfromHL: 'true' },
        headers: { 'User-Agent': 'Mozilla/5.0 (compatible; German-Legal-MCP/1.0)' },
      });
    
      const decision = this.converter.extractDecision(response.data);
      validateConversion(decision.content, 'Rechtsprechung im Internet');
      const markdown = `# ${decision.title}\n\n**Court:** ${decision.court}  \n**Date:** ${decision.date}  \n**File Number:** ${decision.fileNumber}  \n**ECLI:** ${decision.ecli}\n\n---\n\n${decision.content}`;
    
      if (save_path) {
        const { writeFile } = await import('fs/promises');
        await writeFile(save_path, markdown, 'utf-8');
        return { content: [{ type: 'text', text: `Saved to ${save_path}\n\nCourt: ${decision.court}\nDate: ${decision.date}\nFile Number: ${decision.fileNumber}\nECLI: ${decision.ecli}` }] };
      }
    
      return { content: [{ type: 'text', text: markdown }] };
    }
  • Handler for Bavarian (BY) decisions.
    export async function handleBayernGetDecision(args: Record<string, unknown>): Promise<ToolResult> {
      const { doc_id, save_path, section } = args as { doc_id: string; save_path?: string; section?: string };
    
      const html = await fetchBayernDecision(doc_id);
      const d = convertBayernDecision(html);
      validateConversion(d.content, 'gesetze-bayern.de');
    
      const header = [
        `# ${d.title || d.fileNumber}`,
        `\n**Gericht:** ${d.court}`,
        `**Datum:** ${d.date}`,
        `**Aktenzeichen:** ${d.fileNumber}`,
        d.fundstelle ? `**Fundstelle:** ${d.fundstelle}` : '',
        d.normenketten.length ? `**Normenketten:** ${d.normenketten.join('; ')}` : '',
        d.leitsaetze.length ? `\n## Leitsätze\n\n${d.leitsaetze.map((l, i) => `${i + 1}. ${l}`).join('\n')}` : '',
      ].filter(Boolean).join('\n');
    
      const markdown = `${header}\n\n---\n\n${d.content}`;
    
      if (save_path) {
        const { writeFileSync, mkdirSync } = await import('fs');
        const { dirname } = await import('path');
        mkdirSync(dirname(save_path), { recursive: true });
        writeFileSync(save_path, markdown, 'utf-8');
        return { content: [{ type: 'text', text: `Saved to ${save_path} (${markdown.length} chars)\n\nGericht: ${d.court}\nDatum: ${d.date}\nAz: ${d.fileNumber}` }] };
      }
    
      if (section) {
        return { content: [{ type: 'text', text: extractSection(markdown, section) }] };
      }
    
      return { content: [{ type: 'text', text: markdown }] };
    }
  • Definition and input schema for rii:get_decision.
    {
      name: 'rii:get_decision',
      description:
        'Retrieve full text of a court decision by doc ID. ' +
        'Returns decision in Markdown format with metadata (court, date, file number, ECLI). ' +
        'Use source "BY" for IDs from gesetze-bayern.de (format: Y-300-Z-...).',
      inputSchema: z.object({
        doc_id: z.string().describe('Document ID from search results (e.g., "jb-KORE704442026" for BUND, "Y-300-Z-GRURRS-B-2021-N-55699" for BY)'),
        part: z.enum(['K', 'L']).optional().default('L').describe('K = Kurztext (summary), L = Langtext (full text, default). Only for source "BUND".'),
        save_path: z.string().optional().describe('Save full document to this file path instead of returning content. Returns metadata only.'),
        source: z.enum(['BUND', 'BY']).optional().default('BUND').describe('Source: "BUND" (federal, default) or "BY" (Bavarian state courts)'),
        section: z.string().optional().describe('Section heading or "lines:100-200". Only for source "BY".'),
      }),
    },
  • Tool call dispatch logic.
    if (toolName === 'rii:get_decision') {
      return source === 'BY' ? handleBayernGetDecision(args) : this.handleGetDecision(args);
    }
Behavior4/5

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

No annotations provided, so description carries full burden. Discloses output format (Markdown) and specific metadata fields returned (court, date, file number, ECLI). Missing error handling (e.g., invalid ID behavior) but covers core return structure well.

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?

Two sentences, zero waste. First sentence establishes core function and output; second provides critical source-specific guidance. Every word earns its place.

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?

Appropriate for moderate complexity (5 params, source-conditional behavior). Compensates for lack of output schema by describing return format. Could explicitly note that 'part' and 'section' are source-dependent, though schema covers this.

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

Parameters4/5

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

Schema coverage is 100% (baseline 3). Description adds valuable domain context linking 'BY' source to 'gesetze-bayern.de' and reinforces the format pattern, which helps the agent understand the parameter intent beyond the schema's technical enum values.

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?

Specific verb ('Retrieve') + resource ('court decision') + key constraint ('by doc ID'). Clearly distinguishes from sibling 'rii:search' (search vs retrieval) and other domain tools (arxiv, legis, etc.).

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 specific guidance for the 'BY' source (gesetze-bayern.de) and ID format. Implicitly suggests workflow (doc ID retrieval) but does not explicitly reference 'rii:search' as the prerequisite step or state when NOT to use the tool.

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/metaneutrons/german-legal-mcp'

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