rii:search
Search German federal and state court decisions using case numbers or keywords to find relevant rulings and retrieve detailed case information.
Instructions
Search for court decisions. Default source "bund": federal courts (BVerfG, BGH, BVerwG, BFH, BAG, BSG, BPatG). Source "bayern": Bavarian state courts (AG, LG, OLG, VG, VGH, FG, ArbG, LAG, BayVerfGH). Returns list of decisions with metadata and doc IDs for retrieval.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query. For file numbers (Aktenzeichen): use ONLY the file number without keywords (e.g., "I ZR 115/16"). For topics: keywords (e.g., "Metall auf Metall", "BGB § 823"). | |
| limit | Yes | Maximum number of results (default: 10) | |
| source | Yes | Source: "BUND" (federal, default) or "BY" (Bavarian state courts via gesetze-bayern.de) | BUND |
Implementation Reference
- src/providers/rii/provider.ts:43-80 (handler)The 'handleSearch' private method in RiiProvider executes the primary logic for 'rii:search' (BUND source).
private async handleSearch(args: Record<string, unknown>): Promise<ToolResult> { const { query, limit = 10 } = args as { query: string; limit?: number }; const url = `${BASE_URL}/js_peid/Suchportlet2/media-type/html`; logger.info('Searching', { query }); const response = await axios.get(url, { params: { formhaschangedvalue: 'yes', eventSubmit_doSearch: 'suchen', action: 'portlets.jw.MainAction', form: 'jurisExpertSearch', desc: 'text', query, }, headers: { 'User-Agent': 'Mozilla/5.0 (compatible; German-Legal-MCP/1.0)' }, }); const $ = cheerio.load(response.data); const results: Array<{ title: string; docId: string; snippet: string }> = []; $('a.TrefferlisteHervorheben[id^="tlid"]').each((_, el) => { const href = $(el).attr('href') || ''; const docIdMatch = href.match(/doc\.id=([^&]+)/); const title = $(el).attr('title') || $(el).text().trim(); if (docIdMatch && !$(el).attr('id')?.includes('.')) { const snippet = $(el).closest('tr').find('.docPreview').text().trim(); results.push({ title, docId: docIdMatch[1], snippet }); } }); const limitedResults = results.slice(0, limit); const markdown = limitedResults .map((r, i) => `${i + 1}. **${r.title}**\n - Doc ID: \`${r.docId}\`${r.snippet ? `\n - ${r.snippet}` : ''}`) .join('\n\n'); return { content: [{ type: 'text', text: `Found ${results.length} results (showing ${limitedResults.length}):\n\n${markdown}` }] }; } - src/providers/rii/tools/index.ts:5-16 (registration)Tool definition for 'rii:search' including input schema and description.
{ name: 'rii:search', description: 'Search for court decisions. Default source "bund": federal courts (BVerfG, BGH, BVerwG, BFH, BAG, BSG, BPatG). ' + 'Source "bayern": Bavarian state courts (AG, LG, OLG, VG, VGH, FG, ArbG, LAG, BayVerfGH). ' + 'Returns list of decisions with metadata and doc IDs for retrieval.', inputSchema: z.object({ query: z.string().describe('Search query. For file numbers (Aktenzeichen): use ONLY the file number without keywords (e.g., "I ZR 115/16"). For topics: keywords (e.g., "Metall auf Metall", "BGB § 823").'), limit: z.number().optional().default(10).describe('Maximum number of results (default: 10)'), source: z.enum(['BUND', 'BY']).optional().default('BUND').describe('Source: "BUND" (federal, default) or "BY" (Bavarian state courts via gesetze-bayern.de)'), }), },