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
| Name | Required | Description | Default |
|---|---|---|---|
| doc_id | Yes | Document ID from search results (e.g., "jb-KORE704442026" for BUND, "Y-300-Z-GRURRS-B-2021-N-55699" for BY) | |
| part | Yes | K = Kurztext (summary), L = Langtext (full text, default). Only for source "BUND". | L |
| save_path | No | Save full document to this file path instead of returning content. Returns metadata only. | |
| source | Yes | Source: "BUND" (federal, default) or "BY" (Bavarian state courts) | BUND |
| section | No | Section heading or "lines:100-200". Only for source "BY". |
Implementation Reference
- src/providers/rii/provider.ts:82-103 (handler)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".'), }), }, - src/providers/rii/provider.ts:32-34 (registration)Tool call dispatch logic.
if (toolName === 'rii:get_decision') { return source === 'BY' ? handleBayernGetDecision(args) : this.handleGetDecision(args); }