Skip to main content
Glama
paulieb89

GOV UK Search

by paulieb89

Search within a GOV.UK content body

govuk_grep_content
Read-onlyIdempotent

Search GOV.UK pages for a pattern and return matching sections with snippets. Use to answer content-based questions like 'what does this guide say about X?'

Instructions

Find body sections in a GOV.UK content item matching a pattern.

Returns a list of {anchor, heading, snippet, match} hits — small per-section snippets centred on the match — so the LLM can decide which full sections to read via govuk_get_section.

Use this when answering content-based questions ("what does this guide say about X?", "find the bit about eligibility") rather than navigating by section number.

Pattern is regex; if it doesn't compile, falls back to literal substring.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
base_pathYesGOV.UK base_path, e.g. '/guidance/register-for-vat' or '/universal-credit'
patternYesRegex or literal substring to search for within the page body, e.g. 'payment' or 'eligible.*income'
case_insensitiveNoIf true (default), match case-insensitively
max_hitsNoMaximum number of matching sections to return (1–100)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
base_pathYesThe content item that was searched
patternYesThe pattern that was searched for
hitsYesMatching sections in document order
truncatedYesTrue if hit count reached max_hits and more matches may exist

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • addedInput schema / properties / base_path
      Added value: +{
      +  "description": "GOV.UK base_path, e.g. '/guidance/register-for-vat' or '/universal-credit'",
      +  "maxLength": 500,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedInput schema / properties / case_insensitive
      Added value: +{
      +  "default": true,
      +  "description": "If true (default), match case-insensitively",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / max_hits
      Added value: +{
      +  "default": 25,
      +  "description": "Maximum number of matching sections to return (1–100)",
      +  "maximum": 100,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • removedInput schema / properties / params
      Removed value: -{
      -  "additionalProperties": false,
      -  "description": "Input schema for govuk_grep_content.",
      -  "properties": {
      -    "base_path": {
      -      "description": "GOV.UK base_path of a content item, e.g. 'guidance/planning-guidance-letters-to-chief-planning-officers' (leading slash optional). Use govuk_search to discover base_paths.",
      -      "maxLength": 500,
      -      "minLength": 1,
      -      "type": "string"
      -    },
      -    "case_insensitive": {
      -      "default": true,
      -      "description": "Default true.",
      -      "type": "boolean"
      -    },
      -    "max_hits": {
      -      "default": 25,
      -      "description": "Cap on returned hits.",
      -      "maximum": 100,
      -      "minimum": 1,
      -      "type": "integer"
      -    },
      -    "pattern": {
      -      "description": "Regex pattern (or plain substring) to search within the body. If the pattern doesn't compile as regex, falls back to literal substring match.",
      -      "maxLength": 200,
      -      "minLength": 2,
      -      "type": "string"
      -    }
      -  },
      -  "required": [
      -    "base_path",
      -    "pattern"
      -  ],
      -  "type": "object"
      -}
    • addedInput schema / properties / pattern
      Added value: +{
      +  "description": "Regex or literal substring to search for within the page body, e.g. 'payment' or 'eligible.*income'",
      +  "maxLength": 200,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "params"
      -]New value: +[
      +  "base_path",
      +  "pattern"
      +]
  2. First observedv0.2.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already declare readOnlyHint/idempotentHint, so the description adds value by detailing the return structure (`{anchor, heading, snippet, match}`) and the fallback behavior: 'Pattern is regex; if it doesn't compile, falls back to literal substring.' This discloses edge-case behavior beyond the annotations.

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 short paragraphs, each with a distinct purpose: purpose, return format, usage guidance, and pattern behavior. No redundant sentences; front-loaded with the core action.

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?

The description covers what the tool returns, when to use it, how it relates to sibling tools, and the regex fallback. Given the output schema exists, it doesn't need to enumerate return fields, but it does anyway for clarity. The tool's complexity is well handled.

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 adds the fallback semantics for `pattern` and explains that hits are per-section snippets, giving extra meaning to `max_hits` and `pattern` beyond the schema. This additional nuance raises it to 4.

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 opens with a clear verb+resource+scope: 'Find body sections in a GOV.UK content item matching a pattern.' It distinguishes itself from siblings by referencing govuk_get_section and contrasting with 'navigating by section number,' making its purpose unambiguous.

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?

Explicit usage guidance is provided: 'Use this when answering content-based questions ... rather than navigating by section number.' It also prescribes a workflow: 'so the LLM can decide which full sections to read via govuk_get_section,' naming an alternative tool and the condition for its use.

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