get_case_citator
Retrieve citation relationships for a case to verify its legal authority. See which later cases cite it, which authorities it relied on, and which statutes it references. Critical for determining if a case remains good law.
Instructions
Look up citation relationships for a case. Critical for verifying if a case is still good law. Use 'citingCases' to see what later cases cite this decision — if many recent cases cite it approvingly, it is strong authority. Use 'citedCases' to see what authorities this case relied on. Use 'citedLegislations' to see what statutes the case references. Returns the full list of citing/cited items.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| language | No | Language: 'en' for English (default), 'fr' for French | en |
| databaseId | Yes | Court database ID (e.g., 'onsc', 'onca', 'csc-scc') | |
| caseId | Yes | Case unique identifier (e.g., '2021onsc8582') | |
| metadataType | Yes | 'citingCases' = what later cases cite this one (check if still good law); 'citedCases' = what this case relies on; 'citedLegislations' = statutes referenced | |
| publishedBefore | No | Date first published on CanLII (YYYY-MM-DD) | |
| publishedAfter | No | Date first published on CanLII (YYYY-MM-DD) | |
| modifiedBefore | No | Date content last modified on CanLII (YYYY-MM-DD) | |
| modifiedAfter | No | Date content last modified on CanLII (YYYY-MM-DD) | |
| changedBefore | No | Date metadata or content last changed on CanLII (YYYY-MM-DD) | |
| changedAfter | No | Date metadata or content last changed on CanLII (YYYY-MM-DD) | |
| decisionDateBefore | No | Decision date upper bound (YYYY-MM-DD) | |
| decisionDateAfter | No | Decision date lower bound (YYYY-MM-DD) |
Implementation Reference
- src/index.ts:297-347 (handler)The main handler for the get_case_citator tool. It registers an MCP tool that accepts language, databaseId, caseId, metadataType, and optional date parameters, then fetches citation data from the CanLII API at /v1/caseCitator/{language}/{databaseId}/{caseId}/{metadataType}. It parses the response using the appropriate schema (CitedCasesResponseSchema, CitingCasesResponseSchema, or CitedLegislationsResponseSchema) based on the metadataType and returns the result.
// TOOL: get_case_citator // ============================================================ server.tool( "get_case_citator", "Look up citation relationships for a case. Critical for verifying if a case is still good law. " + "Use 'citingCases' to see what later cases cite this decision — if many recent cases cite it approvingly, it is strong authority. " + "Use 'citedCases' to see what authorities this case relied on. " + "Use 'citedLegislations' to see what statutes the case references. " + "Returns the full list of citing/cited items.", { language: z.enum(["en", "fr"]).default("en") .describe("Language: 'en' for English (default), 'fr' for French"), databaseId: pathSegmentSchema .describe("Court database ID (e.g., 'onsc', 'onca', 'csc-scc')"), caseId: pathSegmentSchema .describe("Case unique identifier (e.g., '2021onsc8582')"), metadataType: z.enum(["citedCases", "citingCases", "citedLegislations"]) .describe("'citingCases' = what later cases cite this one (check if still good law); 'citedCases' = what this case relies on; 'citedLegislations' = statutes referenced"), ...dateParametersSchema, }, async (params) => { try { const { language, databaseId, caseId, metadataType, ...dateParams } = params; const urlParams = new URLSearchParams({ api_key: apiKey }); buildDateParams(urlParams, dateParams); const response = await apiFetch( `https://api.canlii.org/v1/caseCitator/${language}/${encodeURIComponent(databaseId)}/${encodeURIComponent(caseId)}/${metadataType}?${urlParams.toString()}` ); if (!response.ok) { return errorResponse(`Error: Failed to fetch case citator data (${response.status})`); } const data = await response.json(); const schemaMap = { citedCases: CitedCasesResponseSchema, citingCases: CitingCasesResponseSchema, citedLegislations: CitedLegislationsResponseSchema, } as const; const parsed = schemaMap[metadataType].parse(data); return jsonResponse(parsed); } catch (error) { return errorResponse( `Error: ${error instanceof Error ? error.message : "Unknown error"}` ); } } ); - src/schema.ts:28-30 (schema)Zod schema for CitedCasesResponse — validates the response when metadataType is 'citedCases', expects an object with an array of CaseSchema under the 'citedCases' key.
export const CitedCasesResponseSchema = z.object({ citedCases: z.array(CaseSchema), }).passthrough(); - src/schema.ts:32-34 (schema)Zod schema for CitingCasesResponse — validates the response when metadataType is 'citingCases', expects an object with an array of CaseSchema under the 'citingCases' key.
export const CitingCasesResponseSchema = z.object({ citingCases: z.array(CaseSchema), }).passthrough(); - src/schema.ts:92-94 (schema)Zod schema for CitedLegislationsResponse — validates the response when metadataType is 'citedLegislations', expects an object with an array of LegislationItemSchema under the 'citedLegislations' key.
export const CitedLegislationsResponseSchema = z.object({ citedLegislations: z.array(LegislationItemSchema), }).passthrough(); - src/index.ts:299-316 (registration)Tool registration for get_case_citator via server.tool(), defining the tool name, description, and input schema including language, databaseId, caseId, metadataType, and date parameters.
server.tool( "get_case_citator", "Look up citation relationships for a case. Critical for verifying if a case is still good law. " + "Use 'citingCases' to see what later cases cite this decision — if many recent cases cite it approvingly, it is strong authority. " + "Use 'citedCases' to see what authorities this case relied on. " + "Use 'citedLegislations' to see what statutes the case references. " + "Returns the full list of citing/cited items.", { language: z.enum(["en", "fr"]).default("en") .describe("Language: 'en' for English (default), 'fr' for French"), databaseId: pathSegmentSchema .describe("Court database ID (e.g., 'onsc', 'onca', 'csc-scc')"), caseId: pathSegmentSchema .describe("Case unique identifier (e.g., '2021onsc8582')"), metadataType: z.enum(["citedCases", "citingCases", "citedLegislations"]) .describe("'citingCases' = what later cases cite this one (check if still good law); 'citedCases' = what this case relies on; 'citedLegislations' = statutes referenced"), ...dateParametersSchema, },