Skip to main content
Glama
legislation.gov.uk MCP Server

legislation.gov.uk MCP Server

by legislation

get_legislation

Read-onlyIdempotent

Retrieve a full UK legislation document by type, year, and number as plain text, XML, Akoma Ntoso, or HTML, including point-in-time versions for tracking amendments and in-force status.

Instructions

Retrieve a full UK legislation document by type, year, and number. Returns readable plain text by default (text). Also available: xml (CLML with full metadata), akn (Akoma Ntoso), html.

Text is best for reading and summarisation. It discards semantic markup, amendment commentaries, and structural metadata — use xml to track amendments, follow cross-references, or check in-force status.

For large documents, use get_legislation_table_of_contents first, then get_legislation_fragment for specific sections.

Common types: ukpga (Acts), uksi (SIs), asp (Scottish Acts), asc (Welsh Acts), nia (NI Acts). type, year, and number must be exact — use search_legislation to confirm if unsure.

Version: use a date (YYYY-MM-DD) for a point-in-time snapshot, or enacted/made/created/adopted for the original version. Do not pass version="prospective"; when metadata lists "prospective", that is the latest version and should be fetched by omitting the version parameter.

See: types://guide, cookbook://point-in-time-version, text://format-guide

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "type": "<type>",
      "year": "<year>",
      "number": "<number>"
    },
    "name": "get_legislation"
  }
}

Input Schema

NameRequiredDescriptionDefault
typeYesType of legislation (e.g., ukpga, uksi, asp, ukla)
yearYesYear of enactment. A 4-digit calendar year (e.g., 2020) works for all legislation. For pre-1963 Acts, the canonical identifier uses a regnal year in Reign/Number format (e.g., Vict/63, Geo5/26) — but a calendar year will usually work too, as the API redirects. Use regnal years when you need to disambiguate (a calendar year can span two regnal years). See the years://regnal resource for valid identifiers.
formatNoResponse format (default: text for readable plain text, xml for CLML, akn for Akoma Ntoso, html for rendered version)
numberYesLegislation number (e.g., 18, 1234)
versionNoOptional: Version to retrieve. Use enacted/made/created/adopted for original version, or YYYY-MM-DD for legislation as it stood on that date. Do not use prospective here; when versions ends with prospective, omit version to fetch that version. Dates before first version return an error.
languageNoOptional: Set to "welsh" to retrieve the Welsh-language text for bilingual legislation (e.g. asc, anaw types). Defaults to "english". Non-bilingual legislation ignores this parameter.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

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

The annotations already establish that this is a read-only, idempotent, non-destructive operation, and the description adds important behavioral context beyond that. It explains what the text format discards, why xml is needed for amendments and cross-references, and that dates before the first version return an error.

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 front-loaded with the core operation and then organized into format, large-document, type, and version guidance. Every paragraph serves a clear caller decision, and there is no redundant or filler wording.

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

Completeness5/5

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

For a six-parameter retrieval tool with no output schema, the description covers the important caller decisions: format tradeoffs, large-document decomposition, identifier exactness, version semantics, and alternatives. The remaining schema-only details, such as language selection, are already fully documented in the input schema.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds meaningful cross-parameter semantics: common legislation type codes, the need for exact type/year/number values, and the special handling of version values including avoiding prospective. It does not need to restate every schema field, but it adds practical meaning beyond them.

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 states a specific verb and resource: retrieve a full UK legislation document by type, year, and number. It also distinguishes itself from siblings by directing large-document callers to get_legislation_table_of_contents and get_legislation_fragment.

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

Usage Guidelines5/5

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

It gives explicit guidance on when to use text versus xml/akn/html, when to use the table-of-contents and fragment tools, when to use search_legislation to confirm identifiers, and how to choose a version. These are concrete usage conditions and alternatives rather than implied preferences.

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