Get PACER Case
get_pacer_caseRetrieve full metadata for a federal court case by providing its case ID. Access case title, parties, court, nature of suit, filing date, and assigned judge from PACER via CourtListener.
Instructions
Look up a single federal court case by its case ID. Returns full case metadata including title, parties, court, nature of suit, filing date, and assigned judge. Source: PACER via CourtListener, updated daily.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| case_id | Yes | The case ID to look up |
Implementation Reference
- src/index.ts:14-14 (registration)Import of registerPacerTools into the main server entry point.
import { registerPacerTools } from "./tools/pacer.js"; - src/index.ts:41-41 (registration)Registration call that wires PACER tools (including get_pacer_case) into the MCP server.
registerPacerTools(server); - src/tools/pacer.ts:118-165 (handler)The full get_pacer_case tool registration: schema (case_id string), handler that calls GET /api/v1/pacer/cases/:caseId, and returns case metadata JSON.
server.registerTool( "get_pacer_case", { title: "Get PACER Case", description: "Look up a single federal court case by its case ID. Returns full case metadata " + "including title, parties, court, nature of suit, filing date, and assigned judge. " + "Source: PACER via CourtListener, updated daily.", inputSchema: { case_id: z .string() .describe("The case ID to look up"), }, }, async ({ case_id }) => { const res = await apiGet<Record<string, unknown>>( `/api/v1/pacer/cases/${encodeURIComponent(case_id)}`, ); if (!res.ok) { if (res.status === 404) { return { content: [ { type: "text" as const, text: `Case ${case_id} not found in PACER dataset.`, }, ], }; } return { content: [ { type: "text" as const, text: `API error (${res.status}): ${JSON.stringify(res.data)}`, }, ], isError: true, }; } return { content: [ { type: "text" as const, text: JSON.stringify(res.data, null, 2) }, ], }; }, ); - src/tools/pacer.ts:29-210 (registration)The registerPacerTools function that registers all three PACER tools (search_pacer_cases, get_pacer_case, pacer_stats) on the MCP server.
export function registerPacerTools(server: McpServer): void { // ── Search cases ───────────────────────────────────────────────────────── server.registerTool( "search_pacer_cases", { title: "Search PACER Cases", description: "Search federal court case records from PACER. Filter by party name, court code, " + "case type, and date range. Returns case metadata including title, parties, court, " + "and filing date. Source: PACER, updated daily. " + "Note: This dataset is coming soon and may not have data yet.", inputSchema: { party: z .string() .optional() .describe("Party name to search for (plaintiff or defendant)"), court: z .string() .optional() .describe( "Federal court code (e.g. cacd = Central District of California, " + "nysd = Southern District of New York, txed = Eastern District of Texas)", ), case_type: z .string() .optional() .describe("Case type (e.g. civil, criminal, bankruptcy)"), date_from: z .string() .optional() .describe("Start date for filing date range (YYYY-MM-DD)"), date_to: z .string() .optional() .describe("End date for filing date range (YYYY-MM-DD)"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum number of results (default 25, max 100)"), }, }, async ({ party, court, case_type, date_from, date_to, limit }) => { const res = await apiGet<PacerCasesResponse>("/api/v1/pacer/cases", { party, court, case_type, date_from, date_to, limit: limit ?? 25, }); if (!res.ok) { if (res.status === 404) { return { content: [ { type: "text" as const, text: "PACER dataset is not yet available. This data source is coming soon.", }, ], }; } return { content: [ { type: "text" as const, text: `API error (${res.status}): ${JSON.stringify(res.data)}`, }, ], isError: true, }; } const { count, data } = res.data; const summary = `Found ${count} PACER case(s).`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, ); // ── Single case lookup ─────────────────────────────────────────────────── server.registerTool( "get_pacer_case", { title: "Get PACER Case", description: "Look up a single federal court case by its case ID. Returns full case metadata " + "including title, parties, court, nature of suit, filing date, and assigned judge. " + "Source: PACER via CourtListener, updated daily.", inputSchema: { case_id: z .string() .describe("The case ID to look up"), }, }, async ({ case_id }) => { const res = await apiGet<Record<string, unknown>>( `/api/v1/pacer/cases/${encodeURIComponent(case_id)}`, ); if (!res.ok) { if (res.status === 404) { return { content: [ { type: "text" as const, text: `Case ${case_id} not found in PACER dataset.`, }, ], }; } return { content: [ { type: "text" as const, text: `API error (${res.status}): ${JSON.stringify(res.data)}`, }, ], isError: true, }; } return { content: [ { type: "text" as const, text: JSON.stringify(res.data, null, 2) }, ], }; }, ); // ── Dataset stats ──────────────────────────────────────────────────────── server.registerTool( "pacer_stats", { title: "PACER Dataset Statistics", description: "Get statistics about the PACER court records dataset: total cases indexed, " + "courts covered, date range, and last updated timestamp. Free endpoint.", inputSchema: {}, }, async () => { const res = await apiGet<PacerStatsResponse>("/api/v1/pacer/stats"); if (!res.ok) { if (res.status === 404) { return { content: [ { type: "text" as const, text: "PACER dataset is not yet available. This data source is coming soon.", }, ], }; } return { content: [ { type: "text" as const, text: `API error (${res.status}): ${JSON.stringify(res.data)}`, }, ], isError: true, }; } return { content: [ { type: "text" as const, text: JSON.stringify(res.data, null, 2) }, ], }; }, ); } - src/client.ts:44-76 (helper)The apiGet helper used by the handler to make HTTP GET requests to the Verilex API.
export async function apiGet<T = unknown>( path: string, params?: Record<string, string | number | undefined>, ): Promise<ApiResponse<T>> { const url = buildUrl(path, params); const headers: Record<string, string> = { Accept: "application/json", "User-Agent": "verilex-mcp-server/0.1.0", }; // Forward x402 payment token if present in env (for paid endpoints) const paymentToken = process.env.VERILEX_PAYMENT_TOKEN; if (paymentToken) { headers["X-Payment-Token"] = paymentToken; } const res = await fetch(url, { headers }); const data = (await res.json()) as T; const stale = res.headers.get("X-Data-Stale"); const lastUpdated = res.headers.get("X-Data-Last-Updated"); const ageSeconds = res.headers.get("X-Data-Age-Seconds"); return { ok: res.ok, status: res.status, data, stale: stale === "true", lastUpdated: lastUpdated ?? undefined, ageSeconds: ageSeconds ? Number(ageSeconds) : undefined, }; }