legislation.gov.uk MCP — the UK's official legislation database. UK legislation ONLY (England/Wales/Scotland/Northern Ireland). Keyless. The API serves XML/Atom, not JSON. No XML parser is available in the Worker, so fields are extracted with regex on a best-effort basis; every response includes the canonical full-text URL and a raw XML excerpt for verification.
Two tools with clear verb-noun naming (search_legislation, get_legislation) and detailed descriptions (194 - 250 chars, within baseline). Input schemas are complete with proper JSON Schema types and required fields. However, output schemas are NOT documented, LLMs cannot predict response structure. Parameter descriptions are good but lack enum constraints for 'type' (should enumerate valid document types). No error handling guidance, no recovery hints, and no output schema documentation. Composition is sound (two distinct, single-purpose tools), but missing pagination guidance for search results.
Get metadata for one specific piece of UK legislation by type + year + number (e.g. ukpga/2010/15 = Equality Act 2010). Returns title, type, year, number, status, extent, enactment date, a long-title summary, and the full-text URL. Content is XML; fields are best-effort parsed and a raw excerpt is included.
Search UK legislation by title words (and optional year), returning matching Acts/instruments with their full-text URLs. UK legislation only. Source: legislation.gov.uk Atom feed. Document types: ukpga (UK Public General Acts), uksi (UK Statutory Instruments), asp (Scottish Parliament Acts), anaw/asc (Wales), nia (Northern Ireland), ukla (UK Local Acts).
Output schemas not documented. LLMs cannot predict response structure (fields, types, nesting). search_legislation returns {source, note, query, totalResults, count, results[], feed_url}; get_legislation returns {source, note, title, type, category, year, number, status, extent, enactment_date, modified, isbn, publisher, summary, full_text_url, data_url, raw_excerpt}. Without documented schemas, agents cannot plan downstream operations or extract fields reliably.
'type' parameter accepts free-form strings with no enum constraint. Description lists valid types (ukpga, uksi, asp, anaw/asc, nia, ukla) but does not enforce them. LLMs may hallucinate invalid types like 'uk_act' or 'statute'. Should declare type as enum with 6 valid values.
No error handling guidance. If legislation.gov.uk returns 404 (document not found), 500 (service error), or malformed XML, the tool throws a generic error. No recovery hints (e.g., 'Try a different year or document type'). Agents cannot self-correct.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | C | 62 | 2026-07-28+ | v2 |
search_legislation returns up to 20 results per page but does not document this limit in the tool description. LLMs may expect all results in one call. Description should state: 'Returns up to 20 results per page. Use the page parameter to paginate.'
Raw XML excerpt (raw_excerpt field, 1200 chars) included in get_legislation response. This is implementation detail noise that wastes tokens and confuses LLMs. Should be omitted or moved to a debug-only field.