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

legislation.gov.uk MCP Server

by legislation

get_legislation_metadata

Read-onlyIdempotent

Retrieve structured metadata for a UK legislation document or specific provision without fetching the full text, including title, status, dates, extent, versions, and unapplied effects.

Instructions

Retrieve structured metadata for a UK legislation document or a specific fragment (Part, Chapter, section, etc.). More efficient than fetching the full document when you only need metadata.

type, year, and number must be exact — use search_legislation to confirm if unsure.

Returns JSON with: id, type, year, number, title, status (draft/final/revised/proposed), extent (e.g. ["E","W","S","NI"]), key dates (enactmentDate/madeDate), version (label of the returned representation), pointInTime (requested date, when present), versions (available milestone version labels), and unappliedEffects (amendments enacted but not yet applied to the text).

prospective is true when the response contains provisions not yet in force; version says whether the returned version is itself the prospective one. The field is never false, and it is absent on enacted/made text. A whole document requested without a version holds no provision text, so there its absence doesn't mean there are no prospective provisions.

unappliedEffects and upToDate are only present for the latest version (no version parameter). When a specific version is requested, both fields are omitted — effects are not tracked for point-in-time snapshots. For the latest version, upToDate is true when all in-force effects have been applied, false when some are outstanding.

Fragment: pass a fragment to scope metadata to a specific provision (e.g. "section/12", "part/2/chapter/1"). unappliedEffects and upToDate are scoped to the fragment for both revised and enacted/made legislation. Use get_legislation_table_of_contents to discover valid fragment IDs.

Version: use a date (YYYY-MM-DD) for a point-in-time snapshot, or enacted/made/created/adopted for the original version. The returned version field labels the version returned (for fragments, it may be earlier than the requested pointInTime). The versions field may also contain the label prospective; that label identifies the prospective version, which is fetched by omitting version rather than by passing it.

For response field details, see json://metadata-response. For legislation type codes, see types://guide. For checking geographical extent, see cookbook://check-extent. For retrieving historical versions, see cookbook://point-in-time-version. For determining whether legislation is up to date and which amendments have yet to be applied, see cookbook://check-outstanding-effects.

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_metadata"
  }
}

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.
numberYesLegislation number (e.g., 2, 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.
fragmentNoOptional: Fragment identifier to scope metadata to a specific provision (e.g. "section/12", "part/2/chapter/1"). Use get_legislation_table_of_contents to discover valid fragment IDs.
languageNoOptional: Set to "welsh" to retrieve Welsh-language metadata for bilingual legislation (e.g. asc, anaw types). Returns Welsh title, dc:language "cy", and uses WelshApplied status for effects. Defaults to "english". Non-bilingual legislation ignores this parameter.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive, and the description goes well beyond them, documenting return fields, the three-valued `prospective` flag (true or absent, never false), and the conditional presence of `unappliedEffects`/`upToDate` only for the latest version. It also warns that on a whole document without `version` there is no provision text, so absence of `prospective` is not evidence. Minor gap: it doesn't state error behavior beyond 'dates before first version return an error' or pagination/size 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?

Front-loads purpose and the efficiency contrast, then organizes the rest under 'Fragment:' and 'Version:' labels with a trailing resource list. It is dense but not padded; the one redundancy is the version paragraph restating what the schema's `version` description already covers.

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?

With no output schema, the description carries the return-value burden and does so thoroughly for a 6-parameter tool, enumerating the JSON fields and their conditional presence. What remains thin is edge-case failure behavior and guidance on the `language` parameter's practical effect beyond what the schema already says.

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; the description still adds meaning, notably that type/year/number must be exact, fragment scoping examples, and the subtlety that the returned `version` label may be earlier than the requested `pointInTime` for fragments. Some of the version guidance duplicates the schema's own version description, keeping it short of a 5.

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?

States a specific verb and resource (retrieve structured metadata for a UK legislation document or a specific fragment) and explicitly contrasts itself with get_legislation: 'More efficient than fetching the full document when you only need metadata.' The scope — whole document vs. fragment — is defined up front.

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?

Names concrete decision points and alternatives: use search_legislation to confirm type/year/number when unsure, and get_legislation_table_of_contents to discover valid fragment IDs. It also explains version selection (date for point-in-time, enacted/made/created/adopted for original, omit version to fetch the prospective version) and points to cookbook resources for historical versions and outstanding effects.

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