Skip to main content
Glama

Get Legislation Table of Contents

legislation_get_toc
Read-onlyIdempotent

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.

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": "legislation_get_toc"
  }
}

Input Schema

NameRequiredDescriptionDefault
typeYeslegislation.gov.uk type code, e.g. 'ukpga' (UK Acts), 'uksi' (UK SIs), 'asp' (Scottish Acts), 'ssi' (Scottish SIs), 'nia' (NI Acts), 'wsi' (Welsh SIs), 'eur' (retained EU regulations). Not 'act' or 'si'. 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. Changed4 schema fields changed
    • changedInput schema / properties / type / description
      Previous value: -"Legislation type code: 'ukpga' (Acts), 'uksi' (SIs), 'asp' (Scottish Acts), 'nia' (NI Acts). Use the value from legislation_search results."New value: +"legislation.gov.uk type code, e.g. 'ukpga' (UK Acts), 'uksi' (UK SIs), 'asp' (Scottish Acts), 'ssi' (Scottish SIs), 'nia' (NI Acts), 'wsi' (Welsh SIs), 'eur' (retained EU regulations). Not 'act' or 'si'. Use the value from legislation_search results."
    • addedInput schema / properties / type / enum
      Added value: +[
      +  "ukpga",
      +  "ukla",
      +  "ukppa",
      +  "gbla",
      +  "apgb",
      +  "gbppa",
      +  "aep",
      +  "aosp",
      +  "asp",
      +  "aip",
      +  "apni",
      +  "mnia",
      +  "nia",
      +  "ukcm",
      +  "mwa",
      +  "anaw",
      +  "asc",
      +  "uksi",
      +  "ssi",
      +  "wsi",
      +  "nisr",
      +  "ukci",
      +  "nisi",
      +  "ukmo",
      +  "nisro",
      +  "ukdsi",
      +  "sdsi",
      +  "nidsr",
      +  "nidsi",
      +  "wdsi",
      +  "eur",
      +  "eudr",
      +  "eudn"
      +]
    • removedInput schema / properties / type / maxLength
      Removed value: -10
    • removedInput schema / properties / type / minLength
      Removed value: -2
  2. Changed7 schema fields changed
    • 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"
      +]
  3. Changed1 schema field changed
    • changedInput schema / properties / params / description
      Previous value: -"LegislationGetTocInput with type, year, number, offset, limit."New value: +"LegislationGetTocInput."
  4. Changed1 schema field changed
    • 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."
  5. Changed10 schema fields changed
    • removedInput schema / properties / date
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "string"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "description": "Optional point-in-time date YYYY-MM-DD for historical version"
      -}
    • removedInput schema / properties / number
      Removed value: -{
      -  "description": "Number, e.g. '46'",
      -  "maxLength": 10,
      -  "minLength": 1,
      -  "type": "string"
      -}
    • addedInput schema / properties / params
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "LegislationGetTocInput with type, year, number, offset, limit.",
      +  "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"
      +}
    • removedInput schema / properties / type
      Removed value: -{
      -  "description": "Legislation type, e.g. 'ukpga', 'uksi'",
      -  "maxLength": 20,
      -  "minLength": 3,
      -  "type": "string"
      -}
    • removedInput schema / properties / year
      Removed value: -{
      -  "description": "Year, e.g. '2006'",
      -  "maxLength": 4,
      -  "minLength": 4,
      -  "type": "string"
      -}
    • changedInput schema / required
      Previous value: -[
      -  "type",
      -  "year",
      -  "number"
      -]New value: +[
      +  "params"
      +]
    • removedOutput schema / additionalProperties
      Removed value: -true
    • addedOutput schema / description
      Added value: +"Paginated table of contents for an Act or Statutory Instrument.\n\nThe upstream XML is fetched in one shot (legislation.gov.uk has no\nserver-side pagination), then sliced client-side via offset/limit.\nFor very large statutes like the Companies Act 2006 (1300+ items)\nuse offset to page through. Check has_more and total_items to\nknow the full size."
    • addedOutput schema / properties
      Added value: +{
      +  "has_more": {
      +    "description": "True if more items remain beyond offset+returned",
      +    "type": "boolean"
      +  },
      +  "items": {
      +    "description": "TOC 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').",
      +    "items": {
      +      "type": "string"
      +    },
      +    "type": "array"
      +  },
      +  "limit": {
      +    "description": "Page size applied after offset",
      +    "type": "integer"
      +  },
      +  "number": {
      +    "description": "Chapter or SI number echoed from the request",
      +    "type": "integer"
      +  },
      +  "offset": {
      +    "description": "Offset applied to the full TOC item list",
      +    "type": "integer"
      +  },
      +  "returned": {
      +    "description": "Number of items in this response",
      +    "type": "integer"
      +  },
      +  "total_items": {
      +    "description": "Total number of structural items parsed from the XML, before offset/limit. Use this to know the full size of the TOC.",
      +    "type": "integer"
      +  },
      +  "type": {
      +    "description": "Legislation type code echoed from the request",
      +    "type": "string"
      +  },
      +  "year": {
      +    "description": "Year of enactment echoed from the request",
      +    "type": "integer"
      +  }
      +}
    • addedOutput schema / required
      Added value: +[
      +  "type",
      +  "year",
      +  "number",
      +  "offset",
      +  "limit",
      +  "returned",
      +  "total_items",
      +  "has_more"
      +]
  6. Changed10 schema fields changed
    • addedInput schema / properties / date
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Optional point-in-time date YYYY-MM-DD for historical version"
      +}
    • addedInput schema / properties / number
      Added value: +{
      +  "description": "Number, e.g. '46'",
      +  "maxLength": 10,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • removedInput schema / properties / params
      Removed value: -{
      -  "additionalProperties": false,
      -  "description": "LegislationGetTocInput with type, year, number, offset, limit.",
      -  "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, e.g. 'ukpga', 'uksi'",
      +  "maxLength": 20,
      +  "minLength": 3,
      +  "type": "string"
      +}
    • addedInput schema / properties / year
      Added value: +{
      +  "description": "Year, e.g. '2006'",
      +  "maxLength": 4,
      +  "minLength": 4,
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "params"
      -]New value: +[
      +  "type",
      +  "year",
      +  "number"
      +]
    • addedOutput schema / additionalProperties
      Added value: +true
    • removedOutput schema / description
      Removed value: -"Paginated table of contents for an Act or Statutory Instrument.\n\nThe upstream XML is fetched in one shot (legislation.gov.uk has no\nserver-side pagination), then sliced client-side via offset/limit.\nFor very large statutes like the Companies Act 2006 (1300+ items)\nuse offset to page through. Check has_more and total_items to\nknow the full size."
    • removedOutput schema / properties
      Removed value: -{
      -  "has_more": {
      -    "description": "True if more items remain beyond offset+returned",
      -    "type": "boolean"
      -  },
      -  "items": {
      -    "description": "TOC 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').",
      -    "items": {
      -      "type": "string"
      -    },
      -    "type": "array"
      -  },
      -  "limit": {
      -    "description": "Page size applied after offset",
      -    "type": "integer"
      -  },
      -  "number": {
      -    "description": "Chapter or SI number echoed from the request",
      -    "type": "integer"
      -  },
      -  "offset": {
      -    "description": "Offset applied to the full TOC item list",
      -    "type": "integer"
      -  },
      -  "returned": {
      -    "description": "Number of items in this response",
      -    "type": "integer"
      -  },
      -  "total_items": {
      -    "description": "Total number of structural items parsed from the XML, before offset/limit. Use this to know the full size of the TOC.",
      -    "type": "integer"
      -  },
      -  "type": {
      -    "description": "Legislation type code echoed from the request",
      -    "type": "string"
      -  },
      -  "year": {
      -    "description": "Year of enactment echoed from the request",
      -    "type": "integer"
      -  }
      -}
    • removedOutput schema / required
      Removed value: -[
      -  "type",
      -  "year",
      -  "number",
      -  "offset",
      -  "limit",
      -  "returned",
      -  "total_items",
      -  "has_more"
      -]
  7. Changed1 schema field changed
    • addedInput schema / properties / params / description
      Added value: +"LegislationGetTocInput with type, year, number, offset, limit."
  8. Changed15 schema fields changed
    • addedInput schema / properties / params / 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 / params / 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"
      +}
    • changedOutput schema / description
      Previous value: -"Generic wrapper for non-object return types."New value: +"Paginated table of contents for an Act or Statutory Instrument.\n\nThe upstream XML is fetched in one shot (legislation.gov.uk has no\nserver-side pagination), then sliced client-side via offset/limit.\nFor very large statutes like the Companies Act 2006 (1300+ items)\nuse offset to page through. Check has_more and total_items to\nknow the full size."
    • addedOutput schema / properties / has_more
      Added value: +{
      +  "description": "True if more items remain beyond offset+returned",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / items
      Added value: +{
      +  "description": "TOC 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').",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / limit
      Added value: +{
      +  "description": "Page size applied after offset",
      +  "type": "integer"
      +}
    • addedOutput schema / properties / number
      Added value: +{
      +  "description": "Chapter or SI number echoed from the request",
      +  "type": "integer"
      +}
    • addedOutput schema / properties / offset
      Added value: +{
      +  "description": "Offset applied to the full TOC item list",
      +  "type": "integer"
      +}
    • removedOutput schema / properties / result
      Removed value: -{
      -  "type": "string"
      -}
    • addedOutput schema / properties / returned
      Added value: +{
      +  "description": "Number of items in this response",
      +  "type": "integer"
      +}
    • addedOutput schema / properties / total_items
      Added value: +{
      +  "description": "Total number of structural items parsed from the XML, before offset/limit. Use this to know the full size of the TOC.",
      +  "type": "integer"
      +}
    • addedOutput schema / properties / type
      Added value: +{
      +  "description": "Legislation type code echoed from the request",
      +  "type": "string"
      +}
    • addedOutput schema / properties / year
      Added value: +{
      +  "description": "Year of enactment echoed from the request",
      +  "type": "integer"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "result"
      -]New value: +[
      +  "type",
      +  "year",
      +  "number",
      +  "offset",
      +  "limit",
      +  "returned",
      +  "total_items",
      +  "has_more"
      +]
    • removedOutput schema / x-fastmcp-wrap-result
      Removed value: -true
  9. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, openWorld and non-destructive, so the safety profile is covered. The description still adds real behavior beyond them: document-order XML ids and titles, retention of untitled provisions as bare ids, offset/limit pagination, and the has_more/total_items signals for large statutes. It does not need to describe return shape further because an output schema exists.

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 the trigger condition, then behavior, then post-call guidance and alternatives — a sensible ordering. Slight redundancy: the pagination sentence and the 'Check has_more and total_items' sentence partly restate what the limit/offset schema descriptions already say.

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?

Five parameters with full schema coverage, an output schema that carries return values, and annotations covering the safety profile — the description fills the remaining gaps (when to use, what to do next, bulk-structure alternative). Nothing an agent needs to invoke it correctly is missing.

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 coverage is 100%, so type codes, year bounds, limit/offset semantics and number are already documented in detail in the schema. The description reinforces pagination and the bare-number convention but contributes little parameter meaning the schema does not already carry, so the baseline 3 applies.

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 ('want the structural table of contents' for a known Act / SI) and enumerates the contents (parts, chapters, sections, regulations, articles). It is clearly distinguishable from legislation_get_section (individual provisions) and read_resource (full raw listing), which are both named.

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?

Explicit when-to-use trigger ('USE THIS TOOL WHEN you have a known Act / SI'), an explicit follow-on routing rule (pass the bare number to legislation_get_section), and an explicit alternative for a different need (read_resource with legislation:// toc URI). Nothing is left to inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.