Skip to main content
Glama
paulieb89

UK Legal Research MCP Server

Get Judgment Header

judgment_get_header
Read-onlyIdempotent

Retrieve metadata for a UK court judgment including parties, judges, neutral citation, court, and dates using a judgment slug. Get a quick orientation before reading specific paragraphs.

Instructions

Get metadata for a UK court judgment: parties, judges, neutral citation, court, dates.

Use case_law_search to find the slug, then call this for orientation before reading specific paragraphs via judgment_get_paragraph.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slugYesJudgment slug, e.g. 'uksc/2024/12' or 'ewca/civ/2023/450'

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The async handler function that executes the 'judgment_get_header' tool logic: fetches judgment XML from TNA and extracts the header element.
    async def judgment_get_header(
        slug: Annotated[str, Field(description="Judgment slug, e.g. 'uksc/2024/12' or 'ewca/civ/2023/450'", min_length=3, max_length=200)],
        ctx: Context,
    ) -> dict:
        """Get metadata for a UK court judgment: parties, judges, neutral citation, court, dates.
    
        Use case_law_search to find the slug, then call this for orientation before
        reading specific paragraphs via judgment_get_paragraph.
        """
        import httpx
        client: httpx.AsyncClient = ctx.lifespan_context["xml_http"]
        resp = await client.get(f"{TNA_BASE}/{slug.lstrip('/')}/data.xml")
        resp.raise_for_status()
        return {"slug": slug, "header": case_law_parsers.extract_header(resp.text)}
  • src/gateway.py:212-214 (registration)
    Registers the 'judgment_get_header' tool with FastMCP gateway, including metadata annotations.
    @gateway.tool(
        name="judgment_get_header",
        annotations={"title": "Get Judgment Header", "readOnlyHint": True, "idempotentHint": True},
  • Input schema: a 'slug' string parameter with Pydantic Field validation (min_length=3, max_length=200). Returns a dict with slug and header.
    slug: Annotated[str, Field(description="Judgment slug, e.g. 'uksc/2024/12' or 'ewca/civ/2023/450'", min_length=3, max_length=200)],
    ctx: Context,
  • Helper function that parses the Akoma Ntoso XML to extract the <header> element using lxml.
    def extract_header(xml_text: str) -> str:
        """Return `<header>...</header>` serialised back to XML."""
        root = _root(xml_text)
        header = root.find(".//akn:header", LEGALDOCML_NS)
        if header is None:
            raise KeyError("No <header> element in this judgment")
        return etree.tostring(header, pretty_print=False).decode()
Behavior3/5

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

Annotations already declare readOnlyHint and idempotentHint, so the description's mention of retrieving metadata aligns but adds no additional behavioral details. Given annotations handle safety, a 3 is appropriate.

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?

The description is three lines: first line states purpose, second provides usage flow. It is concise with no wasted words, and front-loads essential information.

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?

Given the tool has an output schema (not shown), the description doesn't need to explain return values. It covers purpose, usage flow, and relationship to siblings, making it complete for a simple metadata tool.

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?

The input schema already provides a detailed description of the slug parameter with examples. The description reinforces how to obtain the slug via case_law_search, but schema coverage is 100%, so the description adds minimal extra value over the schema.

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 it retrieves metadata for a UK court judgment, listing specific fields (parties, judges, neutral citation, court, dates). It distinguishes from siblings like case_law_search and judgment_get_paragraph, providing a specific verb and resource.

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?

Explicitly advises to use case_law_search to find the slug before calling this tool, and mentions it serves as orientation before using judgment_get_paragraph. This provides clear when-to-use and alternatives.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/paulieb89/uk-legal-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server