Skip to main content
Glama

Search UK legislation

uklaw_search_legislation
Read-onlyIdempotent

Search the UK statute book on legislation.gov.uk by full text or title, or list legislation by type and year, filtered by geographical extent and point in time. Full-text search ranks by relevance; title searches and type/year listings run newest year first and carry type and year counts (facets) to narrow with. Each result gives the item path to pass to uklaw_get_document. For a known citation or short title, uklaw_lookup_citation is cheaper and exact.

Input Schema

NameRequiredDescriptionDefault
pageNoPage number (1–10,000).
textNoFull-text query. Supports AND/OR, "quoted phrases", and stemming. Omit for a title search or a listing.
yearNoCalendar year (also for pre-1963 Acts numbered by regnal year). Not combinable with year_from/year_to.
as_ofNoPoint in time YYYY-MM-DD: only legislation as it stood on that date (items not yet enacted or made are excluded). Omit for current law. Cannot combine with extent.
limitNoResults per page (1–50).
titleNoWords that must all occur in the title. For a known short title or citation, uklaw_lookup_citation is exact.
typesNoType codes (ukpga, uksi, asp, eur, …) and/or groups (all, primary, secondary, eu-origin, draft). "all" covers UK and EU-origin legislation, excluding drafts, and absorbs any other value. uklaw_list_reference topic types lists the codes.
extentNoGeographical extent: england, wales, scotland, ni. An item matches when one of its provisions extends there. Cannot combine with as_of. legislation.gov.uk has not recorded provision-level extent for many recent items, so an empty result does not prove nothing extends there.
year_toNoLatest calendar year of a range; the other bound may be omitted.
year_fromNoEarliest calendar year of a range; the other bound may be omitted.
extent_matchNoUsed only with extent. applicable: a provision extends to any given extent; exact: a provision extends to exactly that set.applicable

Output Schema

NameRequiredDescriptionDefault
capNoPage size that capped the list.
pageNoPage returned.
errorNoPresent when the call failed. Absent on success.
limitNoPage size applied.
scopeNoThe scope applied, defaults included.
shownNoResults on this page.
totalNoTotal matches; present only when legislation.gov.uk reports it (often absent on large result sets).
facetsNoType and year counts — title searches and listings only; absent on full-text searches and on a page past the last page.
noticeNoGuidance when nothing matched, or how to fetch the next page.
resultsNoMatching items on this page.
has_moreNoTrue when a further page exists (call again with page + 1).
truncatedNoTrue when more results exist beyond this page.
attributionNoAttribution lines the returned content requires (OGL always; EU and Westlaw credits when applicable).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnly/openWorld/idempotent, so the safety profile is covered. The description adds real behavioral context beyond that: full-text ranks by relevance, title and type/year listings are newest-year-first and carry type/year facet counts, and each result supplies a path for chaining. It omits rate limits, error/empty-result behavior, and page-traversal cost, which keeps it short of a 5.

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?

Four sentences, all load-bearing: mode description, ranking/ordering and facet behavior, result chaining, and sibling routing. Mode and scope are front-loaded, and there is no filler or restatement of the title.

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?

With an output schema present, the description needn't explain return values, and it still adds the useful fact that each result carries the path for uklaw_get_document. For an 11-parameter, zero-required search tool whose schema is fully documented, nothing an agent needs to call 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 description coverage is 100% and the schema already spells out text syntax, as_of semantics, type codes, extent caveats, and mutual exclusions (as_of vs extent, year vs year_from/to). The description only restates the filter categories at a high level ('filtered by geographical extent and point in time'), so the schema is doing essentially all of the parameter work — the baseline 3.

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 names a specific verb (search/list) and resource (UK statute book on legislation.gov.uk), and explicitly distinguishes three modes: full-text search, title search, and type/year listing. It also names the sibling tools it hands off to (uklaw_get_document for the result path, uklaw_lookup_citation for known citations), so an agent can place it precisely among siblings.

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 explicit routing guidance: use full text for discovery, title/type/year for enumeration, and 'For a known citation or short title, uklaw_lookup_citation is cheaper and exact.' That is a clear when-to-use-this vs when-to-use-alternative statement.

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.