Skip to main content
Glama
UK Legal Research MCP Server

UK Legal Research MCP Server

by paulieb89

Get Legislation Table of Contents

legislation_get_toc
Read-onlyIdempotent

Retrieve the table of contents for a known UK Act or statutory instrument, listing parts, chapters, and provisions in document order. Paginate large statutes and get XML IDs for sections.

Instructions

USE THIS TOOL WHEN you have a known Act / SI and want the structural table of contents (parts, chapters, individual sections/regulations/articles).

Returns XML ids and titles in document order, including Parts, chapters, crossheadings, and provisions; a rare untitled provision is retained as its bare id. Results are paginated with offset/limit.

AFTER calling, pass a provision's bare number (for example 47, not section-47) to legislation_get_section. Check has_more and total_items for large statutes. Use read_resource with the legislation:// toc URI for the full raw listing.

Source: legislation.gov.uk CLML table of contents.

Input Schema

NameRequiredDescriptionDefault
typeYesLegislation type code: 'ukpga' (Acts), 'uksi' (SIs), 'asp' (Scottish Acts), 'nia' (NI Acts). Use the value from legislation_search results.
yearYesYear of enactment
limitNoMaximum items to return in this call (default 200, max 1000). Raise only when you need a larger slice in one response. Check has_more and total_items to know if further pages exist.
numberYesChapter or SI number
offsetNoNumber of items to skip from the flattened TOC. Use with limit to page through very large statutes like the Companies Act 2006 (1300+ items).

Output Schema

NameRequiredDescriptionDefault
typeYesLegislation type code echoed from the request
yearYesYear of enactment echoed from the request
itemsNoTOC entries in XML document order, formatted as '<id>: <title>', e.g. 'section-47: Definitions'. When calling legislation_get_section pass only the numeric part ('47', not 'section-47').
limitYesPage size applied after offset
numberYesChapter or SI number echoed from the request
offsetYesOffset applied to the full TOC item list
has_moreYesTrue if more items remain beyond offset+returned
returnedYesNumber of items in this response
total_itemsYesTotal structural items parsed from the XML, before offset/limit. Compare to `returned` and `has_more` to decide whether to paginate.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv0.6.0
    • addedInput schema / properties / limit
      Added value: +{
      +  "default": 200,
      +  "description": "Maximum items to return in this call (default 200, max 1000). Raise only when you need a larger slice in one response. Check has_more and total_items to know if further pages exist.",
      +  "maximum": 1000,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / properties / number
      Added value: +{
      +  "description": "Chapter or SI number",
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / properties / offset
      Added value: +{
      +  "default": 0,
      +  "description": "Number of items to skip from the flattened TOC. Use with limit to page through very large statutes like the Companies Act 2006 (1300+ items).",
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • removedInput schema / properties / params
      Removed value: -{
      -  "additionalProperties": false,
      -  "description": "LegislationGetTocInput.",
      -  "properties": {
      -    "limit": {
      -      "default": 200,
      -      "description": "Maximum items to return in this call (default 200, max 1000). Raise only when you need a larger slice in one response. Check has_more and total_items to know if further pages exist.",
      -      "maximum": 1000,
      -      "minimum": 1,
      -      "type": "integer"
      -    },
      -    "number": {
      -      "description": "Chapter or SI number",
      -      "minimum": 1,
      -      "type": "integer"
      -    },
      -    "offset": {
      -      "default": 0,
      -      "description": "Number of items to skip from the flattened TOC. Use with limit to page through very large statutes like the Companies Act 2006 (1300+ items).",
      -      "minimum": 0,
      -      "type": "integer"
      -    },
      -    "type": {
      -      "description": "Legislation type code: 'ukpga' (Acts), 'uksi' (SIs), 'asp' (Scottish Acts), 'nia' (NI Acts). Use the value from legislation_search results.",
      -      "maxLength": 10,
      -      "minLength": 2,
      -      "type": "string"
      -    },
      -    "year": {
      -      "description": "Year of enactment",
      -      "maximum": 2100,
      -      "minimum": 1800,
      -      "type": "integer"
      -    }
      -  },
      -  "required": [
      -    "type",
      -    "year",
      -    "number"
      -  ],
      -  "type": "object"
      -}
    • addedInput schema / properties / type
      Added value: +{
      +  "description": "Legislation type code: 'ukpga' (Acts), 'uksi' (SIs), 'asp' (Scottish Acts), 'nia' (NI Acts). Use the value from legislation_search results.",
      +  "maxLength": 10,
      +  "minLength": 2,
      +  "type": "string"
      +}
    • addedInput schema / properties / year
      Added value: +{
      +  "description": "Year of enactment",
      +  "maximum": 2100,
      +  "minimum": 1800,
      +  "type": "integer"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "params"
      -]New value: +[
      +  "type",
      +  "year",
      +  "number"
      +]
  2. Changed2 schema fields changedv0.5.1
    • changedInput schema / properties / params / description
      Previous value: -"LegislationGetTocInput with type, year, number, offset, limit."New value: +"LegislationGetTocInput."
    • changedOutput schema / properties / total_items / description
      Previous value: -"Total number of structural items parsed from the XML, before offset/limit. Use this to know the full size of the TOC."New value: +"Total structural items parsed from the XML, before offset/limit. Compare to `returned` and `has_more` to decide whether to paginate."
  3. Added
  4. Removedv0.4.2
  5. First observedv0.4.0

TDQS

A4.7/5.0
Behavior5/5

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

Beyond the annotations, the description discloses that results are XML ids and titles in document order, includes structural elements and provisions, retains rare untitled provisions as bare ids, and is paginated with offset/limit. It also tells the agent to inspect has_more and total_items for large statutes, which is useful behavioral guidance for consuming the result.

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 primary usage condition, then follows with return details, downstream guidance, and an alternative resource. Every sentence supports correct selection or invocation, and the source note adds useful provenance without bloat.

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 read-only, paginated TOC tool with full schema coverage, annotations, and an output schema, the description provides enough context to select it, understand the shape of results, handle pagination, and route to legislation_get_section or read_resource afterward.

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 description coverage is 100%, so the schema already documents type, year, number, limit, and offset, including examples and pagination behavior. The description reinforces pagination and downstream use of bare provision numbers, but adds little parameter-specific meaning beyond what the schema provides.

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: getting the structural table of contents for a known Act/SI, including parts, chapters, sections, regulations, and articles. It clearly distinguishes this from legislation_get_section by explaining that the TOC is used first and its bare provision number is then passed to the section tool.

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 an explicit trigger: use this when you already have a known Act/SI and want the structural listing. It also routes follow-up work to legislation_get_section and points to read_resource for the full raw listing, covering both primary usage and alternatives.

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