Search within a GOV.UK content body
govuk_grep_contentSearch 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
| Name | Required | Description | Default |
|---|---|---|---|
| base_path | Yes | GOV.UK base_path, e.g. '/guidance/register-for-vat' or '/universal-credit' | |
| pattern | Yes | Regex or literal substring to search for within the page body, e.g. 'payment' or 'eligible.*income' | |
| case_insensitive | No | If true (default), match case-insensitively | |
| max_hits | No | Maximum number of matching sections to return (1–100) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| base_path | Yes | The content item that was searched | |
| pattern | Yes | The pattern that was searched for | |
| hits | Yes | Matching sections in document order | |
| truncated | Yes | True if hit count reached max_hits and more matches may exist |