Skip to main content
Glama

Get Legislation

get_legislation
Read-only

Retrieve metadata for a specific piece of Canadian legislation including title, citation, dates, and repeal status using database and legislation IDs.

Instructions

Get metadata for a specific piece of legislation including title, citation, dates, and repeal status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseIdYesLegislation database ID
languageNoResponse languageen
legislationIdYesLegislation ID from list_legislation (e.g. "rso-1990-c-a1")

Implementation Reference

  • src/server.ts:283-305 (registration)
    Registration of the get_legislation tool with MCP server, including its input schema (databaseId, language, legislationId) and the handler that calls the CanLII API endpoint /legislationBrowse/{language}/{databaseId}/{legislationId}.
    server.registerTool(
    	"get_legislation",
    	{
    		annotations: { readOnlyHint: true },
    		description:
    			"Get metadata for a specific piece of legislation including title, citation, dates, and repeal status.",
    		inputSchema: {
    			databaseId: z.string().describe("Legislation database ID"),
    			language: z.enum(["en", "fr"]).default("en").describe("Response language"),
    			legislationId: z
    				.string()
    				.describe('Legislation ID from list_legislation (e.g. "rso-1990-c-a1")'),
    		},
    		title: "Get Legislation",
    	},
    	async ({ language, databaseId, legislationId }) => {
    		try {
    			return ok(await request(`/legislationBrowse/${language}/${databaseId}/${legislationId}/`));
    		} catch (e) {
    			return err(String(e));
    		}
    	},
    );
  • Handler function for get_legislation: makes an async call to the CanLII legislation browse API with language, databaseId, and legislationId parameters.
    async ({ language, databaseId, legislationId }) => {
    	try {
    		return ok(await request(`/legislationBrowse/${language}/${databaseId}/${legislationId}/`));
    	} catch (e) {
    		return err(String(e));
    	}
    },
  • Input schema for the get_legislation tool defining three parameters: databaseId (string), language (enum en/fr, default en), and legislationId (string).
    inputSchema: {
    	databaseId: z.string().describe("Legislation database ID"),
    	language: z.enum(["en", "fr"]).default("en").describe("Response language"),
    	legislationId: z
    		.string()
    		.describe('Legislation ID from list_legislation (e.g. "rso-1990-c-a1")'),
    },
  • Core HTTP helper function that all tool handlers (including get_legislation) delegate to via the `request` wrapper. Sends authenticated requests to the CanLII API with rate limiting.
    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();
    	}
    }
  • Shorthand wrapper that binds the API key to canliiRequest, used by the get_legislation handler to make the actual API call.
    const request = (path: string, params?: Record<string, string>) =>
    	canliiRequest(apiKey, path, params);
Behavior3/5

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

Annotations already indicate readOnlyHint=true, so the description's mention of 'metadata' aligns but adds no additional behavioral traits (e.g., rate limits, auth needs). No contradiction, but no extra context beyond what annotations provide.

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

Conciseness5/5

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

The description is a single, well-structured sentence with no extraneous words. It is front-loaded with the core purpose and includes key details efficiently.

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?

Without an output schema, the description lists fields returned (title, citation, dates, repeal status) but does not explicitly state the return format (e.g., single object). It is mostly complete for a simple retrieval tool, but could be slightly more precise.

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?

The input schema has 100% description coverage, with all three parameters described. The description mentions 'legislationId' with an example, but does not add significant meaning beyond schema definitions. Baseline score of 3 is appropriate.

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?

The description clearly states the verb 'Get', the resource 'metadata for a specific piece of legislation', and lists included fields (title, citation, dates, repeal status). It effectively distinguishes from sibling tools like list_legislation (listing) and get_case (different resource).

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

Usage Guidelines3/5

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

The description does not explicitly state when to use this tool versus alternatives like list_legislation. Usage is implied (for a single legislation vs. listing), but no direct guidance on when not to use or prerequisites are provided.

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/Vaquill-AI/canlii-mcp'

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