Skip to main content
Glama

get_latest_date

Read-only

Retrieve the most recent available date for a CFR title to avoid 404 errors when using other eCFR tools due to the 1-2 business day lag.

Instructions

Get the most recent available date for a CFR title.

CRITICAL: eCFR lags 1-2 business days behind the Federal Register. Using today's date on versioner endpoints causes 404 errors. Call this first to get the safe date, then pass it to other tools.

Default title 48 = Federal Acquisition Regulations System (FAR, DFARS, and all agency supplements). Other common titles: 2 (Grants/Agreements), 5 (Administrative Personnel), 29 (Labor), 41 (Public Contracts).

Raises ValueError for titles 1-50 that are reserved (no content).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
title_numberNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main tool handler for 'get_latest_date'. Defined as an MCP tool via @mcp.tool decorator. Accepts a title_number (default 48=FAR) and returns the latest available date from the eCFR titles API. Validates the title number, fetches /api/versioner/v1/titles.json, and returns title metadata including up_to_date_as_of, latest_amended_on, and latest_issue_date. Raises ValueError for reserved/not-found titles.
    @mcp.tool(annotations={"title": "Get Latest Date", "readOnlyHint": True, "destructiveHint": False})
    async def get_latest_date(title_number: int = 48) -> dict[str, Any]:
        """Get the most recent available date for a CFR title.
    
        CRITICAL: eCFR lags 1-2 business days behind the Federal Register.
        Using today's date on versioner endpoints causes 404 errors. Call this
        first to get the safe date, then pass it to other tools.
    
        Default title 48 = Federal Acquisition Regulations System (FAR, DFARS,
        and all agency supplements). Other common titles: 2 (Grants/Agreements),
        5 (Administrative Personnel), 29 (Labor), 41 (Public Contracts).
    
        Raises ValueError for titles 1-50 that are reserved (no content).
        """
        title_number = _validate_title_number(title_number)
        data = await _get_json("/api/versioner/v1/titles.json")
        titles = _as_list(_safe_dict(data).get("titles"))
        for title in titles:
            t = _safe_dict(title)
            if _safe_int(t.get("number")) == title_number:
                utd = t.get("up_to_date_as_of")
                if not isinstance(utd, str) or not utd.strip():
                    reserved = t.get("reserved")
                    raise ValueError(
                        f"Title {title_number} has no available content "
                        f"(reserved={reserved}). Reserved titles are placeholders "
                        f"in the CFR numbering scheme without published regulations."
                    )
                return {
                    "title": title_number,
                    "name": t.get("name"),
                    "up_to_date_as_of": utd,
                    "latest_amended_on": t.get("latest_amended_on"),
                    "latest_issue_date": t.get("latest_issue_date"),
                    "reserved": bool(t.get("reserved", False)),
                }
        raise ValueError(f"Title {title_number} not found.")
  • Tool registration via the @mcp.tool decorator with annotations including title 'Get Latest Date', readOnlyHint=True, and destructiveHint=False.
    @mcp.tool(annotations={"title": "Get Latest Date", "readOnlyHint": True, "destructiveHint": False})
  • Internal helper _resolve_date() that shares the same core logic (fetching titles.json and extracting up_to_date_as_of) but returns only the date string. Called by other tools (not get_latest_date itself) to auto-resolve dates before making versioner API calls.
    async def _resolve_date(title_number: int) -> str:
        """Resolve the latest available date for a CFR title.
    
        Called before any versioner endpoint. Using today's date often returns
        404 because eCFR lags 1-2 business days.
    
        Raises ValueError with an actionable message for reserved titles
        (which have null up_to_date_as_of) rather than building a URL with
        'None' in it.
        """
        data = await _get_json("/api/versioner/v1/titles.json")
        titles = _as_list(_safe_dict(data).get("titles"))
        for title in titles:
            t = _safe_dict(title)
            if _safe_int(t.get("number")) == title_number:
                utd = t.get("up_to_date_as_of")
                if not isinstance(utd, str) or not utd.strip():
                    reason = "this title is marked 'reserved'" if t.get("reserved") else (
                        "the API did not return up_to_date_as_of"
                    )
                    raise ValueError(
                        f"Cannot resolve a date for title {title_number}: {reason}. "
                        f"Reserved or un-issued titles have no published content."
                    )
                return utd
        raise ValueError(f"Title {title_number} not found in eCFR titles list.")
  • Validation helper _validate_title_number() used by get_latest_date to ensure title_number is an integer between 1 and 50.
    def _validate_title_number(value: Any, *, field: str = "title_number") -> int:
        """CFR titles are 1-50."""
        if value is None:
            raise ValueError(f"{field} is required.")
        if isinstance(value, bool):
            raise ValueError(f"{field} must be an int 1-50, not bool.")
        try:
            n = int(value)
        except (TypeError, ValueError, OverflowError) as exc:
            # OverflowError catches inf/nan float coercion. Round 6 fix.
            raise ValueError(f"{field} must be an int 1-50. Got {value!r}.") from exc
        if n < 1 or n > 50:
            raise ValueError(f"{field} must be between 1 and 50. Got {n}.")
        return n
  • Error formatting helper that references get_latest_date() in its 404 error message, directing users to call get_latest_date() first if a date exceeds a title's up_to_date_as_of value.
    def _format_error(status: int, body: Any) -> str:
        """Translate common eCFR errors into actionable messages."""
        cleaned = _clean_error_body(body)
        low = cleaned.lower() if isinstance(cleaned, str) else ""
        if status == 404:
            return (
                "HTTP 404: Resource not found. Common causes: (1) the date exceeds "
                "the title's up_to_date_as_of value -- use get_latest_date() first; "
                "(2) the section/part does not exist at the requested date; "
                "(3) 'current' is not a valid date keyword -- use a specific YYYY-MM-DD date. "
                f"API response: {cleaned}"
Behavior5/5

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

Annotations declare readOnlyHint=true. The description adds critical behavior: eCFR lags behind the Federal Register, and using today's date causes 404 errors. It also discloses that the tool raises ValueError for reserved titles (1-50). This adds value beyond the annotations.

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 concise with three short paragraphs, each earning its place: purpose, critical usage, title specifics. No unnecessary information. Front-loaded with the action.

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's simplicity (one optional parameter, output schema exists), the description covers all essential aspects: purpose, usage pattern, critical timing, error cases, and title guidance. An agent can correctly select and invoke this tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description fully compensates. It explains the default title 48 (FAR system) and lists common titles with context. It also notes that reserved titles raise errors. This adds significant meaning 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 clearly states the tool's purpose: 'Get the most recent available date for a CFR title.' It specifies the action (get) and the resource (latest date for CFR title), and distinguishes itself from siblings by positioning it as a preliminary step for other tools.

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 explicitly tells when to use the tool: 'Call this first to get the safe date, then pass it to other tools.' It warns about the lag (1-2 business days) and the consequence of not using it (404 errors). It also provides default and common title numbers, guiding usage.

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/1102tools/federal-contracting-mcps'

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