Skip to main content
Glama
UK Business Tools - Ledgerhall

UK Business Tools - Ledgerhall

Search UK Legislation

law_legislation_search
Read-onlyIdempotent

Search UK Acts and Statutory Instruments by title, phrase, or full text to locate legislation and retrieve ranked results with links for drill-down.

Instructions

USE THIS TOOL WHEN searching UK Acts and Statutory Instruments by title, phrase, or full-text.

Returns ranked results: title, type, year, number, legislation.gov.uk URL, and next_steps hints (toc URI, section template). AFTER calling, chain to legislation_get_toc then legislation_get_section for structural drill-in.

Filter discipline: type and year are exact-match. Use only when you already know the value. For currency-driven searches, query by phrase and read the returned year; guessing an exact year can zero results. For broader concept queries across content, set fulltext=True. If the default title route receives a typed legislation.gov.uk WAF/non-XML failure, the tool automatically tries that documented full-text route once and marks search_mode="fulltext_fallback"; its broader relevance semantics must not be treated as a title-ranked result. Render-pending and ordinary HTTP failures do not trigger this fallback.

Source: legislation.gov.uk Atom search feed, with an explicit fallback marker when the alternative official full-text route supplied results.

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": {
      "query": "<query>"
    },
    "name": "law_legislation_search"
  }
}

Input Schema

NameRequiredDescriptionDefault
typeNoFilter by type: 'ukpga' (Acts), 'uksi' (SIs), 'asp' (Scottish Acts), 'nia' (NI Acts). Exact-match — omit if you don't already know whether you're looking for an Act vs an SI.
yearNoFilter by year of enactment (exact-match — a single integer, not a range). Omit unless you already know the Act's year. Speculating a year (e.g. 'this is recent so it must be 2026') and getting it wrong will zero out the result set. Better workflow: query without `year`, then read the year from the returned results.
limitNoMaximum results to return (1–50). Passed to the upstream results-count param.
queryYesSearch query, e.g. 'Housing Act 1988' or 'data protection personal data'
fulltextNoDefault false → searches Act/SI titles only (best for finding a named Act, e.g. 'Housing Act 1988' returns ukpga/1988/50 first). Set true to search the full text of every Act/SI for the query (returns SIs and regulations that cite the term — e.g. 'rental deposits' would return many implementing instruments).

Output Schema

NameRequiredDescriptionDefault
totalYesTotal number of matches
resultsYesMatching legislation items
search_modeNoRoute that produced these results. fulltext_fallback means the title route was unavailable because legislation.gov.uk returned a typed WAF/non-XML failure, so the server retried once using the documented full-text route; relevance may therefore be broader than title search.title
fallback_reasonNoTyped upstream reason that triggered the automatic full-text fallback, or null when the requested route completed normally.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.3.0
    • addedOutput schema / properties / fallback_reason
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Typed upstream reason that triggered the automatic full-text fallback, or null when the requested route completed normally."
      +}
    • addedOutput schema / properties / search_mode
      Added value: +{
      +  "default": "title",
      +  "description": "Route that produced these results. fulltext_fallback means the title route was unavailable because legislation.gov.uk returned a typed WAF/non-XML failure, so the server retried once using the documented full-text route; relevance may therefore be broader than title search.",
      +  "enum": [
      +    "title",
      +    "fulltext",
      +    "fulltext_fallback"
      +  ],
      +  "type": "string"
      +}
  2. First observedv0.2.1

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnly, idempotent, openWorld, non-destructive), so the description correctly spends its words elsewhere: ranked-result fields, next_steps hints, and the automatic WAF/non-XML full-text fallback marked as search_mode="fulltext_fallback" with a warning not to treat it as title-ranked output. That is real behavioral disclosure beyond the structured fields, though it stops short of describing result-set size limits or ranking determinism.

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 phrase and the chain, and every paragraph carries operational content. The fallback paragraph is dense and reads like internal implementation notes, but it earns its space because the agent must interpret the fallback marker. Slightly over-long for the payload.

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?

For a 5-parameter search tool with an output schema, the description covers the trigger, the downstream chain, filter discipline, the full-text alternative, and the degradation path. Nothing an agent needs in order to call it and interpret results is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3; the description earns a bump by explaining the tradeoff behind `fulltext` (title-only vs. instruments that merely cite the term) and the failure mode of guessing `year`. Much of the type/year guidance restates what the schema descriptions already say, which keeps it below 5.

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?

Opens with a specific verb+resource+scope: searching UK Acts and Statutory Instruments by title, phrase, or full-text. It also distinguishes itself from the structural siblings (legislation_get_toc, legislation_get_section) that it chains into, so an agent can place it in the workflow without opening any schema.

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?

Gives explicit when-to-use routing ('USE THIS TOOL WHEN...'), an explicit next-step chain ('AFTER calling, chain to legislation_get_toc then legislation_get_section'), and an explicit exclusion rule: don't set exact-match type/year unless the value is already known. It also names the condition that selects the alternative full-text route (broad concept queries → fulltext=True).

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

Deploy Server

Other Tools