get_legislation_fragment
Retrieve a specific section, part, or chapter of UK legislation in plain text or structured formats, with optional point-in-time versions for focused reading, summarisation, or amendment checks.
Instructions
Retrieve a fragment (section, part, chapter, etc.) of a UK legislation document. 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.
type, year, and number must be exact — use search_legislation to confirm if unsure. Use get_legislation_table_of_contents to discover fragment IDs. Common fragmentId patterns: section/1, part/2, part/1/chapter/3, regulation/5, crossheading/name. The API does not support fragment IDs deeper than the section or regulation level (e.g. section/1/a is not a valid ID).
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 fragment version and should be fetched by omitting the version parameter.
See: types://guide, cookbook://point-in-time-version
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>",
"fragmentId": "<fragmentId>"
},
"name": "get_legislation_fragment"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | Type of legislation (e.g., ukpga, uksi, asp, ukla) | |
| year | Yes | Year 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. | |
| format | No | Response format (default: text for readable plain text, xml for CLML, akn for Akoma Ntoso, html for rendered version) | |
| number | Yes | Legislation number (e.g., 18, 1234) | |
| version | No | Optional: 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. | |
| language | No | Optional: 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. | |
| fragmentId | Yes | Fragment identifier path (e.g., section/5, part/1/chapter/2, regulation/10) |