Skip to main content
Glama

get_case_law_decisions

List case law decisions from a Canadian court database. Apply date filters on publication, modification, or decision dates. Results ordered by most recently added for efficient browsing.

Instructions

List case law decisions from a specific court database. Use date filters to narrow results. Useful for browsing recent decisions from a specific court. Results are ordered by most recently added. Use get_case_metadata to get full details on a specific case.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
languageNoLanguage: 'en' for English (default), 'fr' for Frenchen
databaseIdYesCourt database ID (e.g., 'onsc' for Ontario Superior Court, 'onca' for Ontario Court of Appeal, 'csc-scc' for Supreme Court of Canada)
offsetNoStart position for results (default 0 = most recent)
resultCountNoNumber of results to return (max 10,000, default 20)
publishedBeforeNoDate first published on CanLII (YYYY-MM-DD)
publishedAfterNoDate first published on CanLII (YYYY-MM-DD)
modifiedBeforeNoDate content last modified on CanLII (YYYY-MM-DD)
modifiedAfterNoDate content last modified on CanLII (YYYY-MM-DD)
changedBeforeNoDate metadata or content last changed on CanLII (YYYY-MM-DD)
changedAfterNoDate metadata or content last changed on CanLII (YYYY-MM-DD)
decisionDateBeforeNoDecision date upper bound (YYYY-MM-DD)
decisionDateAfterNoDecision date lower bound (YYYY-MM-DD)

Implementation Reference

  • The async handler function that executes the get_case_law_decisions tool logic: calls the CanLII caseBrowse API with language, databaseId, offset, resultCount, and date parameters, then parses the response with CasesResponseSchema.
    	async (params) => {
    		try {
    			const { language, databaseId, offset, resultCount, ...dateParams } = params;
    
    			const urlParams = new URLSearchParams({
    				api_key: apiKey,
    				offset: offset.toString(),
    				resultCount: resultCount.toString(),
    			});
    			buildDateParams(urlParams, dateParams);
    
    			const response = await apiFetch(
    				`https://api.canlii.org/v1/caseBrowse/${language}/${encodeURIComponent(databaseId)}/?${urlParams.toString()}`
    			);
    
    			if (!response.ok) {
    				return errorResponse(`Error: Failed to fetch case law decisions (${response.status})`);
    			}
    
    			const data = await response.json();
    			const parsed = CasesResponseSchema.parse(data);
    			return jsonResponse(parsed);
    		} catch (error) {
    			return errorResponse(
    				`Error: ${error instanceof Error ? error.message : "Unknown error"}`
    			);
    		}
    	}
    );
  • src/index.ts:208-252 (registration)
    Tool registration via server.tool() with name 'get_case_law_decisions', description, and Zod schema for parameters (language enum, databaseId, offset, resultCount, date parameters).
    server.tool(
    	"get_case_law_decisions",
    	"List case law decisions from a specific court database. Use date filters to narrow results. " +
    	"Useful for browsing recent decisions from a specific court. " +
    	"Results are ordered by most recently added. Use get_case_metadata to get full details on a specific case.",
    	{
    		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' for Ontario Superior Court, 'onca' for Ontario Court of Appeal, 'csc-scc' for Supreme Court of Canada)"),
    		offset: z.number().default(0)
    			.describe("Start position for results (default 0 = most recent)"),
    		resultCount: z.number().max(10000).default(20)
    			.describe("Number of results to return (max 10,000, default 20)"),
    		...dateParametersSchema,
    	},
    	async (params) => {
    		try {
    			const { language, databaseId, offset, resultCount, ...dateParams } = params;
    
    			const urlParams = new URLSearchParams({
    				api_key: apiKey,
    				offset: offset.toString(),
    				resultCount: resultCount.toString(),
    			});
    			buildDateParams(urlParams, dateParams);
    
    			const response = await apiFetch(
    				`https://api.canlii.org/v1/caseBrowse/${language}/${encodeURIComponent(databaseId)}/?${urlParams.toString()}`
    			);
    
    			if (!response.ok) {
    				return errorResponse(`Error: Failed to fetch case law decisions (${response.status})`);
    			}
    
    			const data = await response.json();
    			const parsed = CasesResponseSchema.parse(data);
    			return jsonResponse(parsed);
    		} catch (error) {
    			return errorResponse(
    				`Error: ${error instanceof Error ? error.message : "Unknown error"}`
    			);
    		}
    	}
    );
  • CasesResponseSchema - Zod schema defining the response shape: { cases: array of CaseSchema objects }. Used to parse the API response.
    export const CasesResponseSchema = z.object({
        cases: z.array(CaseSchema),
    }).passthrough();
  • CaseSchema - Zod schema for individual case objects in the browse results (databaseId, caseId, title, citation, aiContentId).
    export const CaseSchema = z.object({
        databaseId: z.string(),
        caseId: CaseIdSchema,
        title: z.string(),
        citation: z.string(),
        aiContentId: z.record(z.string(), z.string()).optional(),
    }).passthrough();
  • dateParametersSchema - shared Zod schema object for date filter parameters (publishedBefore/After, modifiedBefore/After, changedBefore/After, decisionDateBefore/After) used by the tool via spread operator.
    const dateParametersSchema = {
    	publishedBefore: dateSchema.describe("Date first published on CanLII (YYYY-MM-DD)"),
    	publishedAfter: dateSchema.describe("Date first published on CanLII (YYYY-MM-DD)"),
    	modifiedBefore: dateSchema.describe("Date content last modified on CanLII (YYYY-MM-DD)"),
    	modifiedAfter: dateSchema.describe("Date content last modified on CanLII (YYYY-MM-DD)"),
    	changedBefore: dateSchema.describe("Date metadata or content last changed on CanLII (YYYY-MM-DD)"),
    	changedAfter: dateSchema.describe("Date metadata or content last changed on CanLII (YYYY-MM-DD)"),
    	decisionDateBefore: dateSchema.describe("Decision date upper bound (YYYY-MM-DD)"),
    	decisionDateAfter: dateSchema.describe("Decision date lower bound (YYYY-MM-DD)"),
    };
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It discloses that results are ordered by most recently added, which is key behavior. However, it does not mention any potential side effects, authorization needs, or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two efficient sentences that front-load the main purpose and add relevant usage context. Could be slightly more structured, but overall concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the 12 parameters (all documented in schema) and no output schema, the description sufficiently explains the tool's purpose, ordering, and relationship to sibling tools. References get_case_metadata for full details, which helps complete the picture.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with clear parameter descriptions. The description adds high-level purpose but does not provide additional meaning beyond what the schema already specifies for parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool lists case law decisions from a specific court database, with date filtering capabilities. It explicitly distinguishes from the sibling tool get_case_metadata, which provides full details on a specific case.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear context for use (browsing recent decisions from a specific court) and mentions an alternative tool (get_case_metadata) for full details. However, it does not explicitly mention when not to use this tool or other alternatives like 'search'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mohammadfarooqi/canlii-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server