Skip to main content
Glama
paulieb89

UK Legal Research MCP Server

Resolve Single OSCOLA Citation

citations_resolve
Read-onlyIdempotent

Parse and resolve a single OSCOLA citation to its canonical URL. Supports neutral citations, SIs, and legislation sections.

Instructions

Parse and resolve a single OSCOLA citation to its canonical URL.

Supports: neutral citations, SIs, legislation sections, retained EU law. Returns parsed fields and resolved_url if resolvable. Raises ValueError if no recognised citation is found in the input.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYesCitationsResolveInput with a single citation string.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
rawYesOriginal citation text as found in the source
typeYesClassification of the citation type
yearNoYear component of the citation
courtNoCourt code: UKSC, UKPC, EWCA Civ, EWCA Crim, EWHC (KB), EWHC (Ch), EWHC (Comm), EWHC (Fam), EWHC (Pat), EWHC (IPEC), UKUT (IAC), UKUT (TCC), UKUT (AAC), UKUT (LC), EAT, UKFTT (TC), UKFTT (GRC)
numberNoJudgment number within the year
report_seriesNoLaw report series abbreviation: WLR, AC, QB, KB, Ch, All ER, EWCA Civ, etc.
volumeNoReport volume number (for law reports)
pageNoStarting page in the law report
legislation_titleNoTitle of legislation (for s.NN Act YYYY citations)
sectionNoSection number referenced
si_yearNoSI year (for SI YYYY/NNN citations)
si_numberNoSI number
resolved_urlNoTNA Find Case Law or legislation.gov.uk URL if successfully resolved
confidenceYesParse confidence 0.0–1.0. Citations below 0.7 are ambiguous and may have been sent for LLM disambiguation.

Implementation Reference

  • The `citations_resolve` handler function: parses and resolves a single OSCOLA citation to canonical URL. Registered as an MCP tool with name 'resolve'. Delegates to `_compile_patterns()` and `_extract_all_citations()` for parsing, returning the first matched `ParsedCitation` or raising `ValueError` if none found.
    @mcp.tool(
        name="resolve",
        annotations={"title": "Resolve Single OSCOLA Citation", "readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": False},
    )
    async def citations_resolve(params: CitationsResolveInput) -> ParsedCitation:
        """Parse and resolve a single OSCOLA citation to its canonical URL.
    
        Supports: neutral citations, SIs, legislation sections, retained EU law.
        Returns parsed fields and resolved_url if resolvable. Raises ValueError
        if no recognised citation is found in the input.
    
        Args:
            params: CitationsResolveInput with a single citation string.
        """
        patterns = _compile_patterns()
        confident, ambiguous = _extract_all_citations(params.citation.strip(), patterns)
        all_found = confident + ambiguous
        if not all_found:
            raise ValueError(
                f"No recognised OSCOLA citation found in '{params.citation}'. "
                f"Supported: [YYYY] COURT N, [YYYY] N SERIES PAGE, s.N Act YYYY, SI YYYY/N, Regulation (EU) YYYY/N"
            )
        return all_found[0]
  • `CitationsResolveInput` Pydantic model: input schema for the citations_resolve tool. Accepts a single `citation` string (3-500 chars) as the sole required field.
    class CitationsResolveInput(BaseModel):
        model_config = ConfigDict(str_strip_whitespace=True, extra="forbid")
    
        citation: str = Field(
            ...,
            description="A single OSCOLA citation to parse and resolve. E.g. '[2024] UKSC 12', 'SI 2018/1234', 's.47 Companies Act 2006'",
            min_length=3,
            max_length=500,
        )
  • Registration of `citations_resolve` as an MCP tool via `@mcp.tool(name='resolve', ...)` decorator inside the `register_tools()` function. The tool is decorated with annotations: readOnlyHint=True, idempotentHint=True.
    @mcp.tool(
        name="resolve",
        annotations={"title": "Resolve Single OSCOLA Citation", "readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": False},
    )
    async def citations_resolve(params: CitationsResolveInput) -> ParsedCitation:
        """Parse and resolve a single OSCOLA citation to its canonical URL.
    
        Supports: neutral citations, SIs, legislation sections, retained EU law.
        Returns parsed fields and resolved_url if resolvable. Raises ValueError
        if no recognised citation is found in the input.
    
        Args:
            params: CitationsResolveInput with a single citation string.
        """
        patterns = _compile_patterns()
        confident, ambiguous = _extract_all_citations(params.citation.strip(), patterns)
        all_found = confident + ambiguous
        if not all_found:
            raise ValueError(
                f"No recognised OSCOLA citation found in '{params.citation}'. "
                f"Supported: [YYYY] COURT N, [YYYY] N SERIES PAGE, s.N Act YYYY, SI YYYY/N, Regulation (EU) YYYY/N"
            )
        return all_found[0]
  • The citations MCP server is created and `register_tools(citations_mcp)` is called, which wires up all tools including citations_resolve. The instructions reference citations_resolve as a user-facing tool.
    citations_mcp = FastMCP(
        name="citations",
        instructions=(
            "Parse and resolve OSCOLA legal citations from free text. "
            "Use citations_parse to extract all citations from a judgment, memo, or article. "
            "Use citations_resolve to resolve a single known citation to its canonical URL. "
            "Use citations_network to map all cases and legislation cited within a judgment. "
            "Supports: neutral citations, law reports, legislation sections, SIs, retained EU law. "
            "No external API dependency — fully self-contained."
        ),
    )
    
    register_tools(citations_mcp)
  • `ParsedCitation` model — the return type of `citations_resolve`. Contains parsed fields like `raw`, `type`, `year`, `court`, `number`, `resolved_url`, `confidence`, etc.
    class ParsedCitation(BaseModel):
        """A single parsed OSCOLA citation with optional resolution."""
    
        model_config = ConfigDict(str_strip_whitespace=True)
    
        raw: str = Field(..., description="Original citation text as found in the source")
        type: CitationType = Field(..., description="Classification of the citation type")
        year: int | None = Field(None, description="Year component of the citation")
        court: str | None = Field(
            None,
            description=(
                "Court code: UKSC, UKPC, EWCA Civ, EWCA Crim, EWHC (KB), EWHC (Ch), "
                "EWHC (Comm), EWHC (Fam), EWHC (Pat), EWHC (IPEC), UKUT (IAC), UKUT (TCC), "
                "UKUT (AAC), UKUT (LC), EAT, UKFTT (TC), UKFTT (GRC)"
            ),
        )
        number: int | None = Field(None, description="Judgment number within the year")
        report_series: str | None = Field(
            None,
            description="Law report series abbreviation: WLR, AC, QB, KB, Ch, All ER, EWCA Civ, etc.",
        )
        volume: int | None = Field(None, description="Report volume number (for law reports)")
        page: int | None = Field(None, description="Starting page in the law report")
        legislation_title: str | None = Field(None, description="Title of legislation (for s.NN Act YYYY citations)")
        section: str | None = Field(None, description="Section number referenced")
        si_year: int | None = Field(None, description="SI year (for SI YYYY/NNN citations)")
        si_number: int | None = Field(None, description="SI number")
        resolved_url: str | None = Field(
            None,
            description="TNA Find Case Law or legislation.gov.uk URL if successfully resolved",
        )
        confidence: float = Field(
            ...,
            description="Parse confidence 0.0–1.0. Citations below 0.7 are ambiguous and may have been sent for LLM disambiguation.",
            ge=0.0,
            le=1.0,
        )
Behavior4/5

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

The description adds behavioral information beyond annotations: it states returns (parsed fields and resolved_url) and error handling (raises ValueError). Annotations already declare readonly, idempotent, non-destructive, so no contradiction.

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 extremely concise: two sentences plus a bullet list of supported types. It is front-loaded with the purpose and contains no unnecessary words.

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 low complexity (single parameter), rich annotations, and presence of an output schema, the description is complete. It explains core functionality, supported inputs, return values, and error behavior.

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% with a clear description and examples for the citation parameter. The tool description further adds context by listing supported citation types, enhancing understanding beyond 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 uses specific verbs 'parse and resolve' and identifies the resource as 'OSCOLA citation'. It clearly differentiates from siblings like 'citations_parse' (likely only parses) and 'citations_network' (network of citations).

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

Usage Guidelines3/5

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

The description lists supported citation types (neutral citations, SIs, legislation sections, retained EU law) and mentions error behavior. However, it does not explicitly state when to use this tool over alternatives like citations_parse, nor does it provide explicit 'when not to use' guidance.

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