icu:get_document
Retrieve full-text CJEU decisions or opinions from InfoCuria by case or CELEX number. Extract specific sections like paragraph ranges or headings, or save documents to files for legal research.
Instructions
Retrieve a CJEU decision or opinion from InfoCuria by case number or CELEX number. Returns full text in Markdown with Randnummern as [Rn. 5]{.rn}. Use section for partial content: "Rn 5-12", heading text, or "lines:100-200". Use save_path to save to file instead of returning content.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| case_id | Yes | Published case ID (e.g., "C-476/17") or CELEX number (e.g., "62017CJ0476") | |
| language | Yes | Language code (default: DE) | DE |
| section | No | Extract section: "Rn 5-12", heading text, or "lines:100-200" | |
| save_path | No | Save full document to this file path instead of returning content |
Implementation Reference
- src/providers/icu/provider.ts:73-113 (handler)The `handleGetDocument` method implements the logic for fetching, converting, and (optionally) saving a document from InfoCuria.
private async handleGetDocument(args: Record<string, unknown>): Promise<ToolResult> { const { case_id, language = 'DE', section, save_path } = args as { case_id: string; language?: string; section?: string; save_path?: string; }; // Resolve case_id to logicDocId via search const logicDocId = await this.resolveLogicDocId(case_id, language as string); if (!logicDocId) { return { content: [{ type: 'text', text: `No document found for "${case_id}" in ${language}` }], isError: true }; } const numericId = logicDocId.replace('id_', ''); logger.info('Fetching document', { case_id, numericId, language }); const response = await axios.get(`${BLOB_URL}/${numericId}/${language.toUpperCase()}/html`, { headers: { 'Origin': 'https://infocuria.curia.europa.eu' }, responseType: 'text', }); const markdown = this.converter.convert(response.data); validateConversion(markdown, 'InfoCuria'); // Section extraction if (section) { const extracted = this.extractSection(markdown, section); if (!extracted) { return { content: [{ type: 'text', text: `Section "${section}" not found.` }], isError: true }; } return { content: [{ type: 'text', text: extracted }] }; } const fullDoc = `# ${case_id}\n\n---\n\n${markdown}`; if (save_path) { const { writeFile } = await import('fs/promises'); await writeFile(save_path, fullDoc, 'utf-8'); return { content: [{ type: 'text', text: `Saved to ${save_path}\n\nCase: ${case_id}\nLanguage: ${language}` }] }; } return { content: [{ type: 'text', text: fullDoc }] }; } - The input schema and tool description for `icu:get_document`.
{ name: 'icu:get_document', description: 'Retrieve a CJEU decision or opinion from InfoCuria by case number or CELEX number. ' + 'Returns full text in Markdown with Randnummern as [Rn. 5]{.rn}. ' + 'Use `section` for partial content: "Rn 5-12", heading text, or "lines:100-200". ' + 'Use `save_path` to save to file instead of returning content.', inputSchema: z.object({ case_id: z.string().describe('Published case ID (e.g., "C-476/17") or CELEX number (e.g., "62017CJ0476")'), language: z.string().optional().default('DE').describe('Language code (default: DE)'), section: z.string().optional().describe('Extract section: "Rn 5-12", heading text, or "lines:100-200"'), save_path: z.string().optional().describe('Save full document to this file path instead of returning content'), }), }, - src/providers/icu/provider.ts:32-32 (registration)The `handleToolCall` method routes the `icu:get_document` call to its handler.
if (toolName === 'icu:get_document') return this.handleGetDocument(args);