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

legislation.gov.uk MCP Server

by legislation

get_legislation_table_of_contents

Read-onlyIdempotent

Retrieve a UK legislation document's hierarchical table of contents, including Parts, Chapters, Sections, headings, and fragment IDs, to locate provisions before fetching a specific fragment.

Instructions

Retrieve the table of contents for a UK legislation document. Returns structured JSON by default (json). Also available: xml, akn, html.

Shows the hierarchical structure (Parts, Chapters, Sections) with headings and fragment IDs for use with get_legislation_fragment.

meta.prospective is true when the response indicates that the document contains provisions not yet in force. It is left out on enacted/made text. Contents entries are marked inconsistently, so its absence doesn't mean there are no prospective provisions.

type, year, and number must be exact. If you're not certain, use search_legislation to confirm — identifiers guessed from general knowledge are often wrong.

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, json://table-of-contents-response

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

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).
formatNoResponse format (default: json for structured data, xml for CLML Contents, 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.
languageNoOptional: Set to "welsh" to retrieve the Welsh-language table of contents 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.8/5.0
Behavior5/5

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

Goes well beyond the annotations (which only declare read-only/idempotent safety) by disclosing the default and alternate output formats, the structure of the returned hierarchy, and the semantic subtlety of meta.prospective being marked inconsistently so its absence is not proof of no prospective provisions. It also warns that guessed identifiers are often wrong, which is actionable behavioral context.

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-loaded with purpose and return shape, then layered caveats; every paragraph is short and purposeful. Minor redundancy between the version paragraph and the version parameter description, but no wasted sentences.

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?

No output schema exists, so the description must carry the return contract — and it does, describing the hierarchical Parts/Chapters/Sections structure, headings, fragment IDs, and the meta.prospective flag. It also points to three reference resources (types://guide, cookbook://point-in-time-version, json://table-of-contents-response) for anything deeper.

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 bar is at least 3; the description adds real value with the 'must be exact' constraint on type/year/number and an escape hatch to search_legislation, plus the non-obvious prohibition on version="prospective". The version guidance largely restates what the schema field already says, capping it below 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?

Opens with a specific verb+resource ('Retrieve the table of contents for a UK legislation document') and immediately states the output shape and its role as a precursor to get_legislation_fragment, so the agent can place it relative to siblings like get_legislation 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?

Explicitly routes the agent: use search_legislation when type/year/number are uncertain, use the returned fragment IDs with get_legislation_fragment, use a date or enacted/made/created/adopted for versions, and never pass version="prospective" — instead omit the parameter. Both when-to-use and when-not-to-use are stated.

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