List Case Databases
list_case_databasesRetrieve a list of all courts and tribunals in the CanLII collection along with their database IDs. Filter results by language (English or French) to identify available jurisdictions.
Instructions
List all courts and tribunals in the CanLII collection with their database IDs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| language | No | Response language | en |
Implementation Reference
- src/server.ts:111-117 (handler)The handler function for the 'list_case_databases' tool. It calls the CanLII API endpoint /caseBrowse/{language}/ and returns the JSON result, or an error message on failure.
async ({ language }) => { try { return ok(await request(`/caseBrowse/${language}/`)); } catch (e) { return err(String(e)); } }, - src/server.ts:106-109 (schema)Input schema for the tool: takes an optional 'language' parameter (enum: 'en' or 'fr') defaulting to 'en'.
inputSchema: { language: z.enum(["en", "fr"]).default("en").describe("Response language"), }, title: "List Case Databases", - src/server.ts:99-118 (registration)Registration of the 'list_case_databases' tool via server.registerTool() with annotations, description, title, input schema, and handler.
// 1. List case databases server.registerTool( "list_case_databases", { annotations: { readOnlyHint: true }, description: "List all courts and tribunals in the CanLII collection with their database IDs.", inputSchema: { language: z.enum(["en", "fr"]).default("en").describe("Response language"), }, title: "List Case Databases", }, async ({ language }) => { try { return ok(await request(`/caseBrowse/${language}/`)); } catch (e) { return err(String(e)); } }, ); - src/server.ts:50-71 (helper)The canliiRequest helper function that performs the actual HTTP call to the CanLII API with rate limiting. Used by the handler to call /caseBrowse/{language}/.
async function canliiRequest( apiKey: string, path: string, params: Record<string, string> = {}, ): Promise<unknown> { await acquireSlot(); try { const url = new URL(`${BASE_URL}${path}`); url.searchParams.set("api_key", apiKey); for (const [k, v] of Object.entries(params)) { if (v !== undefined && v !== "") url.searchParams.set(k, v); } const res = await fetch(url.toString()); if (!res.ok) { const body = await res.text(); throw new Error(`CanLII API ${res.status}: ${body}`); } return await res.json(); } finally { releaseSlot(); } }