Skip to main content
Glama
paulieb89

UK Legal Research MCP Server

Get Judgment Paragraph

judgment_get_paragraph
Read-onlyIdempotent

Retrieve a single paragraph from a UK court judgment by its slug and paragraph eId. First discover eIds by using the index tool.

Instructions

Get a single paragraph from a UK court judgment by its LegalDocML eId.

Use judgment_get_index first to discover available eIds. Returns the paragraph XML content (400–1,700 tokens typical).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slugYesJudgment slug, e.g. 'uksc/2024/12'
eIdYesParagraph eId from judgment_get_index, e.g. 'para_12'

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/gateway.py:258-262 (registration)
    Tool registration for 'judgment_get_paragraph' on the gateway FastMCP instance via @gateway.tool decorator.
    @gateway.tool(
        name="judgment_get_paragraph",
        annotations={"title": "Get Judgment Paragraph", "readOnlyHint": True, "idempotentHint": True},
    )
    async def judgment_get_paragraph(
  • Handler function: fetches judgment XML from TNA, calls extract_paragraph parser, returns dict with slug, eId, and content.
    async def judgment_get_paragraph(
        slug: Annotated[str, Field(description="Judgment slug, e.g. 'uksc/2024/12'", min_length=3, max_length=200)],
        eId: Annotated[str, Field(description="Paragraph eId from judgment_get_index, e.g. 'para_12'", min_length=1, max_length=100)],
        ctx: Context,
    ) -> dict:
        """Get a single paragraph from a UK court judgment by its LegalDocML eId.
    
        Use judgment_get_index first to discover available eIds. Returns the paragraph
        XML content (400–1,700 tokens typical).
        """
        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()
        content = case_law_parsers.extract_paragraph(resp.text, eId)
        return {"slug": slug, "eId": eId, "content": content}
  • Input schema (inline Pydantic Field annotations): slug (min_length=3, max_length=200) and eId (min_length=1, max_length=100).
    slug: Annotated[str, Field(description="Judgment slug, e.g. 'uksc/2024/12'", min_length=3, max_length=200)],
    eId: Annotated[str, Field(description="Paragraph eId from judgment_get_index, e.g. 'para_12'", min_length=1, max_length=100)],
    ctx: Context,
  • Pure-function helper that parses LegalDocML XML and extracts a single paragraph by eId using lxml XPath.
    def extract_paragraph(xml_text: str, eId: str) -> str:
        """Return a single `<paragraph eId="X">` serialised back to XML."""
        root = _root(xml_text)
        el = root.find(f".//akn:paragraph[@eId='{eId}']", LEGALDOCML_NS)
        if el is None:
            raise KeyError(f"No paragraph with eId={eId!r}")
        return etree.tostring(el, pretty_print=False).decode()
Behavior4/5

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

Adds value beyond annotations by specifying return format (paragraph XML content) and typical token range (400–1700 tokens). No contradiction with readOnlyHint and idempotentHint.

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?

Two sentences, zero wasted words. First sentence states purpose, second provides prerequisite and typical output size. Highly efficient and front-loaded.

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?

For a simple retrieval tool with well-specified parameters and known output schema, the description covers key aspects: what, prerequisite, output format and size. Could add error conditions or more detail, but sufficient.

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%, but description adds crucial context for eId ('from judgment_get_index'), enhancing schema. Slug description suffices. Description adds meaningful guidance beyond 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 the tool retrieves a single paragraph from a UK court judgment by its LegalDocML eId, using specific verb and resource. It distinguishes from siblings like judgment_get_index and judgment_get_header.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly advises using judgment_get_index first to discover eIds, giving clear context on prerequisite. Mentions typical token range but no explicit when-not-to-use or alternative tools beyond the index.

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