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.

Input Schema

TableJSON 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

TableJSON 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

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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"
      +]
  2. Changed1 schema field changed
    • changedInput schema / properties / params / description
      Previous value: -"Input schema for case_law_grep_judgment."New value: +"CaseLawGrepInput."
  3. 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."
  4. Added

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, openWorldHint, idempotentHint, and destructiveHint, covering safety. The description adds valuable behavioral context: it returns only small snippets (not full paragraphs), and it discloses the regex fallback to literal substring search if compilation fails. This goes beyond the annotations and is helpful for setting expectations.

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?

The description is well-structured and front-loaded with a directive usage trigger, followed by concise notes on return format, post-processing, and fallback behavior. It contains no redundant filler, though the 'AFTER calling' clause could be seen as slightly verbose but is still informative.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (4 parameters, output schema present), the description covers purpose, usage, output format, and follow-up actions, which is sufficient for tool selection. It does not mention max_hits or case_insensitive defaults, but those are already well-documented in the schema, so the description need not repeat them.

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 baseline is 3. The description does not add new parameter-level meaning beyond the schema; it only restates the regex fallback already present in the pattern property description. The schema itself documents all four parameters well, so no extra benefit is derived from the description.

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 clearly states that the tool searches paragraphs within a specific UK court judgment matching a pattern, using a specific verb and resource. It also distinguishes from siblings by explicitly mentioning judgment_get_index for paragraph-number navigation and judgment_get_paragraph for reading full paragraphs.

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?

The description opens with 'USE THIS TOOL WHEN you have a judgment slug and want to find paragraphs whose text matches a pattern', providing a clear trigger condition. It also gives a concrete use case, an explicit alternative for index navigation, and follow-up guidance to retrieve full paragraphs, making usage guidance explicit and actionable.

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.