search_legislation
Find UK legislation by keyword, title, type, year, extent, department, or subject. Filter, sort, and paginate results from legislation.gov.uk.
Instructions
Search for UK legislation by keyword, title, or other criteria on legislation.gov.uk. Returns JSON by default (set format="xml" for raw Atom feed).
Results include: id, type, year, number, title, and date. Use q for full-text keyword search, title for title search. Filter by type, year, startYear/endYear range, subject, department, extent, or language. Use sort to order results. Returns 20 results per page — use page to paginate; check meta.morePages in the response.
subject only applies to SI-family types (uksi, ssi, wsi, nisr, etc.); Acts don't carry subject metadata. If subject is set without a type, secondary is used by default.
See: types://guide, json://search-response, atom://feed-guide
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "search_legislation"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | No | Full-text keyword search across legislation content | |
| page | No | Page number (default: 1, 20 results per page) | |
| sort | No | Sort order for results. Options: - `relevance` — by match score; only meaningful with `q`, `title`, or `subject`. - `published` — publication date, newest first. - `title` — alphabetical. - `type` — grouped by legislation type. - `subject` — alphabetical by subject heading; only meaningful with `subject`. - `basic` — the site's fallback ordering. Category-grouped alphabetically, then year descending, then number descending. EU content (category `euretained`) sorts ahead of `primary` and `secondary`. Use with `q` to bypass relevance ranking. If omitted: `relevance` when `q` is set; `subject` when `subject` is set without `q`; otherwise `basic`. | |
| type | No | Filter by legislation type. Each value is either a short type code (e.g. `ukpga`, `uksi`, `asp`; see `types://guide` for the full list) or an aggregation: `all`, `primary` (all Acts), `secondary` (all SIs), `eu-origin` (EU-retained), or `uk`/`wales`/`scotland`/`ni` (jurisdiction-level groupings). Pass multiple values to match any of them. `["primary", "secondary"]` is usually the most useful filter — it returns all Acts and SIs and excludes EU-retained legislation, which otherwise dominates results. Other examples: `["uksi", "ssi"]` for UK and Scottish SIs only. | |
| year | No | Filter by specific year | |
| title | No | Search in legislation titles | |
| extent | No | Filter by geographic extent: E (England), W (Wales), S (Scotland), NI (Northern Ireland). Multiple values match legislation that extends to all of those jurisdictions (unless `exactExtent` is true). | |
| format | No | Response format (default: json for structured results, xml for raw Atom feed) | |
| endYear | No | End of year range (inclusive) | |
| subject | No | Filter by subject heading (e.g. 'banking', 'housing', 'africa'). Only applies to SI-family types; sets `type` to `secondary` by default. | |
| language | No | Filter by language: english (the default) or welsh | |
| startYear | No | Start of year range (inclusive) | |
| department | No | Filter by government department responsible for the legislation | |
| exactExtent | No | If true, only return legislation whose extent is exactly the specified set and nothing else (default: false) |