get_case_citator_tease
Preview up to 5 citation relationships for a case to quickly determine if it has been cited. Faster than a full citator, ideal for initial checks before requesting complete citation data.
Instructions
Quick preview of citation relationships (max 5 results). Faster than the full citator. Use this for a quick check on whether a case has been cited, then use get_case_citator for the complete list if needed.
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 | Type of citation data to preview |
Implementation Reference
- src/index.ts:366-393 (handler)Handler function for the get_case_citator_tease tool. Calls the CanLII API v1/caseCitatorTease endpoint, parses response based on metadataType using the appropriate schema, and returns JSON. Supports citedCases, citingCases, and citedLegislations metadata types.
async ({ language, databaseId, caseId, metadataType }) => { try { const params = new URLSearchParams({ api_key: apiKey }); const response = await apiFetch( `https://api.canlii.org/v1/caseCitatorTease/${language}/${encodeURIComponent(databaseId)}/${encodeURIComponent(caseId)}/${metadataType}?${params.toString()}` ); if (!response.ok) { return errorResponse(`Error: Failed to fetch citator tease 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/index.ts:352-394 (registration)Registration of the get_case_citator_tease tool via server.tool(). Defines input schema (language, databaseId, caseId, metadataType) and description explaining it's a quick preview (max 5 results) faster than the full citator.
server.tool( "get_case_citator_tease", "Quick preview of citation relationships (max 5 results). Faster than the full citator. " + "Use this for a quick check on whether a case has been cited, then use get_case_citator for the complete list if needed.", { 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("Type of citation data to preview"), }, async ({ language, databaseId, caseId, metadataType }) => { try { const params = new URLSearchParams({ api_key: apiKey }); const response = await apiFetch( `https://api.canlii.org/v1/caseCitatorTease/${language}/${encodeURIComponent(databaseId)}/${encodeURIComponent(caseId)}/${metadataType}?${params.toString()}` ); if (!response.ok) { return errorResponse(`Error: Failed to fetch citator tease 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)CitedCasesResponseSchema — validates responses with a 'citedCases' array of CaseSchema objects. Used by the handler when metadataType is 'citedCases'.
export const CitedCasesResponseSchema = z.object({ citedCases: z.array(CaseSchema), }).passthrough(); - src/schema.ts:32-34 (schema)CitingCasesResponseSchema — validates responses with a 'citingCases' array of CaseSchema objects. Used by the handler when metadataType is 'citingCases'.
export const CitingCasesResponseSchema = z.object({ citingCases: z.array(CaseSchema), }).passthrough(); - src/schema.ts:92-94 (schema)CitedLegislationsResponseSchema — validates responses with a 'citedLegislations' array of LegislationItemSchema objects. Used by the handler when metadataType is 'citedLegislations'.
export const CitedLegislationsResponseSchema = z.object({ citedLegislations: z.array(LegislationItemSchema), }).passthrough();