Skip to main content
Glama

Search within a UK Court Judgment

case_law_grep_judgment
Read-onlyIdempotent

USE THIS TOOL WHEN you have a judgment slug and want to find paragraphs whose text matches a pattern.

Returns a list of {eId, snippet, match} hits — small per-paragraph snippets centred on the match. AFTER calling, read full paragraphs via judgment_get_paragraph(slug, eId) or the judgment://{slug}/para/{eId} resource.

Use case: content search within one judgment (e.g. "negligence", "test for foreseeability", "Donoghue"). For paragraph-number navigation by eId, call judgment_get_index instead.

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

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": {
      "slug": "<slug>",
      "pattern": "<pattern>"
    },
    "name": "case_law_grep_judgment"
  }
}

Input Schema

NameRequiredDescriptionDefault
slugYesTNA judgment slug, e.g. 'uksc/2024/12' or 'ewca/civ/2023/450'.
patternYesRegex pattern (or plain substring) to search within paragraph text. If the pattern doesn't compile as regex, falls back to literal substring match.
max_hitsNoCap on number of hits returned.
case_insensitiveNoDefault true. Set false for case-sensitive matching.

Output Schema

NameRequiredDescriptionDefault
hitsYesMatching paragraphs in document order
slugYesThe judgment slug that was searched
patternYesThe pattern that was searched for
truncatedYesTrue if hit count reached max_hits and more matches may exist
attributionNoOpen Justice Licence attribution for the Find Case Law content in this result.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedOutput schema / properties / attribution
      Added value: +{
      +  "description": "Open Justice Licence attribution for the Find Case Law content in this result.",
      +  "properties": {
      +    "licence_url": {
      +      "default": "https://caselaw.nationalarchives.gov.uk/open-justice-licence/version/2",
      +      "description": "The Open Justice Licence v2.0.",
      +      "type": "string"
      +    },
      +    "statement": {
      +      "default": "Contains information licensed under the Open Justice - Licence v2.0.",
      +      "description": "Attribution required by the Open Justice Licence. Include it, verbatim, wherever this judgment content is shown or reused.",
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed6 schema fields changed
    • addedInput schema / properties / case_insensitive
      Added value: +{
      +  "default": true,
      +  "description": "Default true. Set false for case-sensitive matching.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / max_hits
      Added value: +{
      +  "default": 25,
      +  "description": "Cap on number of hits returned.",
      +  "maximum": 100,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • removedInput schema / properties / params
      Removed value: -{
      -  "additionalProperties": false,
      -  "description": "CaseLawGrepInput.",
      -  "properties": {
      -    "case_insensitive": {
      -      "default": true,
      -      "description": "Default true. Set false for case-sensitive matching.",
      -      "type": "boolean"
      -    },
      -    "max_hits": {
      -      "default": 25,
      -      "description": "Cap on number of hits returned.",
      -      "maximum": 100,
      -      "minimum": 1,
      -      "type": "integer"
      -    },
      -    "pattern": {
      -      "description": "Regex pattern (or plain substring) to search within paragraph text. If the pattern doesn't compile as regex, falls back to literal substring match.",
      -      "maxLength": 200,
      -      "minLength": 2,
      -      "type": "string"
      -    },
      -    "slug": {
      -      "description": "TNA judgment slug, e.g. 'uksc/2024/12' or 'ewca/civ/2023/450'.",
      -      "minLength": 8,
      -      "type": "string"
      -    }
      -  },
      -  "required": [
      -    "slug",
      -    "pattern"
      -  ],
      -  "type": "object"
      -}
    • addedInput schema / properties / pattern
      Added value: +{
      +  "description": "Regex pattern (or plain substring) to search within paragraph text. If the pattern doesn't compile as regex, falls back to literal substring match.",
      +  "maxLength": 200,
      +  "minLength": 2,
      +  "type": "string"
      +}
    • addedInput schema / properties / slug
      Added value: +{
      +  "description": "TNA judgment slug, e.g. 'uksc/2024/12' or 'ewca/civ/2023/450'.",
      +  "minLength": 8,
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "params"
      -]New value: +[
      +  "slug",
      +  "pattern"
      +]
  3. Changed1 schema field changed
    • changedInput schema / properties / params / description
      Previous value: -"Input schema for case_law_grep_judgment."New value: +"CaseLawGrepInput."
  4. Changed1 schema field changed
    • changedOutput schema / properties / hits / items / properties / eId / description
      Previous value: -"LegalDocML paragraph identifier, e.g. 'para_12'"New value: +"LegalDocML paragraph identifier, e.g. 'para_12'. Use as {eId} in judgment://{slug*}/para/{eId} to read the full paragraph (typically 400-1700 tokens) with its sub-paragraphs."
  5. Added

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive and open-world, so the safety profile is covered. The description adds genuinely useful behavior beyond that: the hit shape ({eId, snippet, match}) with snippets centred on the match, the recommended follow-up call, and the regex-to-literal-substring fallback when compilation fails. Some of the return-shape detail overlaps with the output schema, which keeps this from 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.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the triggering condition, then return shape, then next steps, then disambiguation — a sensible order with little waste. Minor redundancy: the regex-to-substring fallback is stated in the description and again in the pattern parameter's schema description.

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?

Covers what the tool does, when to use it, what comes back, what to do next, the sibling to use instead for a different task, and the edge case of a non-compiling regex. For a read-only search tool with full schema and output-schema coverage, 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%, so the schema already documents slug format, pattern length limits and the regex fallback. The description reinforces pattern semantics and gives example queries but says nothing about max_hits or case_insensitive, so it adds only marginal meaning over the structured fields.

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?

States a specific verb and resource: find paragraphs within a judgment whose text matches a pattern, given a judgment slug. It also distinguishes itself from judgment_get_index (eId/paragraph-number navigation) and from judgment_get_paragraph (full-text retrieval), so an agent can pick the right tool without opening a 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?

Opens with an explicit 'USE THIS TOOL WHEN' precondition (you have a slug and want pattern matching) and names the alternative, judgment_get_index, for paragraph-number navigation by eId. It also gives concrete usage examples ('negligence', 'test for foreseeability') that anchor the intended query shape.

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.