List Available Courts
list_courtsRetrieve details of available courts and their document counts to access Swiss legal decisions via the entscheidsuche.ch API.
Instructions
Get information about available courts and their document counts
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:350-372 (handler)Handler function for the 'list_courts' tool. Calls client.getCourtStatus() to fetch court statuses, formats as JSON text response, handles errors.
async () => { try { const courts = await client.getCourtStatus(); return { content: [ { type: "text", text: `Available Courts:\n\n${JSON.stringify(courts, null, 2)}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error retrieving court information: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } } - src/index.ts:51-57 (schema)TypeScript interface defining the structure of court status objects returned by the tool.
interface CourtStatus { name: string; total_documents: number; new_documents: number; last_run: string; status: string; } - src/index.ts:343-373 (registration)Registration of the 'list_courts' tool with server.registerTool, providing title, description, empty input schema, and handler reference.
server.registerTool( "list_courts", { title: "List Available Courts", description: "Get information about available courts and their document counts", inputSchema: {} }, async () => { try { const courts = await client.getCourtStatus(); return { content: [ { type: "text", text: `Available Courts:\n\n${JSON.stringify(courts, null, 2)}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error retrieving court information: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } } ); - src/index.ts:185-197 (helper)Supporting method getCourtStatus() in EntscheidungsucheClient class, currently provides mock data for court statuses.
async getCourtStatus(): Promise<CourtStatus[]> { // This would need to be implemented by scraping the status page // For now, return a mock response return [ { name: "Bundesgericht", total_documents: 15000, new_documents: 45, last_run: "2024-01-15", status: "Komplett gelesen" } ]; }