UNPKG

@us-legal-tools/courtlistener-sdk

Version:

TypeScript SDK and MCP server for CourtListener API

1,474 lines (1,471 loc) 52.1 kB
var __create = Object.create; var __getProtoOf = Object.getPrototypeOf; var __defProp = Object.defineProperty; var __getOwnPropNames = Object.getOwnPropertyNames; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __hasOwnProp = Object.prototype.hasOwnProperty; var __toESM = (mod, isNodeMode, target) => { target = mod != null ? __create(__getProtoOf(mod)) : {}; const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target; for (let key of __getOwnPropNames(mod)) if (!__hasOwnProp.call(to, key)) __defProp(to, key, { get: () => mod[key], enumerable: true }); return to; }; var __moduleCache = /* @__PURE__ */ new WeakMap; var __toCommonJS = (from) => { var entry = __moduleCache.get(from), desc; if (entry) return entry; entry = __defProp({}, "__esModule", { value: true }); if (from && typeof from === "object" || typeof from === "function") __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable })); __moduleCache.set(from, entry); return entry; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true, configurable: true, set: (newValue) => all[name] = () => newValue }); }; // src/mcp/index.ts var exports_mcp = {}; __export(exports_mcp, { postRecapFetchHandler: () => postRecapFetchHandler, postDocketAlertsHandler: () => postDocketAlertsHandler, postCitationLookupHandler: () => postCitationLookupHandler, postAlertsHandler: () => postAlertsHandler, getVisualizationsIdHandler: () => getVisualizationsIdHandler, getVisualizationsHandler: () => getVisualizationsHandler, getSpouseIncomeIdHandler: () => getSpouseIncomeIdHandler, getSpouseIncomeHandler: () => getSpouseIncomeHandler, getSearchHandler: () => getSearchHandler, getSchoolsIdHandler: () => getSchoolsIdHandler, getSchoolsHandler: () => getSchoolsHandler, getReimbursementsIdHandler: () => getReimbursementsIdHandler, getReimbursementsHandler: () => getReimbursementsHandler, getRecapIdHandler: () => getRecapIdHandler, getRecapHandler: () => getRecapHandler, getProcessingQueueHandler: () => getProcessingQueueHandler, getPositionsIdHandler: () => getPositionsIdHandler, getPositionsHandler: () => getPositionsHandler, getPoliticalAffiliationsIdHandler: () => getPoliticalAffiliationsIdHandler, getPoliticalAffiliationsHandler: () => getPoliticalAffiliationsHandler, getPeopleIdHandler: () => getPeopleIdHandler, getPeopleHandler: () => getPeopleHandler, getPacerDocIdsHandler: () => getPacerDocIdsHandler, getOriginalProceedingsPanelsHandler: () => getOriginalProceedingsPanelsHandler, getOpinionsIdHandler: () => getOpinionsIdHandler, getOpinionsHandler: () => getOpinionsHandler, getNonInvestmentIncomeIdHandler: () => getNonInvestmentIncomeIdHandler, getNonInvestmentIncomeHandler: () => getNonInvestmentIncomeHandler, getJudgePositionsIdHandler: () => getJudgePositionsIdHandler, getJudgePositionsHandler: () => getJudgePositionsHandler, getInvestmentsIdHandler: () => getInvestmentsIdHandler, getInvestmentsHandler: () => getInvestmentsHandler, getHandler: () => getHandler, getGiftsIdHandler: () => getGiftsIdHandler, getGiftsHandler: () => getGiftsHandler, getFinancialDisclosuresIdHandler: () => getFinancialDisclosuresIdHandler, getFinancialDisclosuresHandler: () => getFinancialDisclosuresHandler, getDocketsIdHandler: () => getDocketsIdHandler, getDocketsHandler: () => getDocketsHandler, getDocketAlertsHandler: () => getDocketAlertsHandler, getDebtsIdHandler: () => getDebtsIdHandler, getDebtsHandler: () => getDebtsHandler, getCourtsIdHandler: () => getCourtsIdHandler, getCourtsHandler: () => getCourtsHandler, getClustersIdHandler: () => getClustersIdHandler, getClustersHandler: () => getClustersHandler, getCitationsIdHandler: () => getCitationsIdHandler, getCitationsHandler: () => getCitationsHandler, getAudioIdHandler: () => getAudioIdHandler, getAudioHandler: () => getAudioHandler, getAlertsHandler: () => getAlertsHandler, getAgreementsIdHandler: () => getAgreementsIdHandler, getAgreementsHandler: () => getAgreementsHandler, PostDocketAlertsBodyAlertType: () => PostDocketAlertsBodyAlertType, PostAlertsBodyRate: () => PostAlertsBodyRate, PostAlertsBodyAlertType: () => PostAlertsBodyAlertType, GetSearchType: () => GetSearchType, GetSearchOrderBy: () => GetSearchOrderBy, GetSearchHighlight: () => GetSearchHighlight, GetCourtsJurisdiction: () => GetCourtsJurisdiction, CourtJurisdiction: () => CourtJurisdiction }); module.exports = __toCommonJS(exports_mcp); // src/mcp/http-client.ts var getGetUrl = () => { return `https://www.courtlistener.com/api/rest/v4/`; }; var get = async (options) => { const res = await fetch(getGetUrl(), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetSearchUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/search/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/search/`; }; var getSearch = async (params, options) => { const res = await fetch(getGetSearchUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getPostCitationLookupUrl = () => { return `https://www.courtlistener.com/api/rest/v4/citation-lookup/`; }; var postCitationLookup = async (postCitationLookupBody, options) => { const res = await fetch(getPostCitationLookupUrl(), { ...options, method: "POST", headers: { "Content-Type": "application/json", ...options?.headers }, body: JSON.stringify(postCitationLookupBody) }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetDocketsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/dockets/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/dockets/`; }; var getDockets = async (params, options) => { const res = await fetch(getGetDocketsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetDocketsIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/dockets/${id}/`; }; var getDocketsId = async (id, options) => { const res = await fetch(getGetDocketsIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetClustersUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/clusters/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/clusters/`; }; var getClusters = async (params, options) => { const res = await fetch(getGetClustersUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetClustersIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/clusters/${id}/`; }; var getClustersId = async (id, options) => { const res = await fetch(getGetClustersIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetOpinionsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/opinions/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/opinions/`; }; var getOpinions = async (params, options) => { const res = await fetch(getGetOpinionsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetOpinionsIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/opinions/${id}/`; }; var getOpinionsId = async (id, options) => { const res = await fetch(getGetOpinionsIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetCourtsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/courts/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/courts/`; }; var getCourts = async (params, options) => { const res = await fetch(getGetCourtsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetCourtsIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/courts/${id}/`; }; var getCourtsId = async (id, options) => { const res = await fetch(getGetCourtsIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetPeopleUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/people/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/people/`; }; var getPeople = async (params, options) => { const res = await fetch(getGetPeopleUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetPeopleIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/people/${id}/`; }; var getPeopleId = async (id, options) => { const res = await fetch(getGetPeopleIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetAudioUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/audio/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/audio/`; }; var getAudio = async (params, options) => { const res = await fetch(getGetAudioUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetAudioIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/audio/${id}/`; }; var getAudioId = async (id, options) => { const res = await fetch(getGetAudioIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetFinancialDisclosuresUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/financial-disclosures/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/financial-disclosures/`; }; var getFinancialDisclosures = async (params, options) => { const res = await fetch(getGetFinancialDisclosuresUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetFinancialDisclosuresIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/financial-disclosures/${id}/`; }; var getFinancialDisclosuresId = async (id, options) => { const res = await fetch(getGetFinancialDisclosuresIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetInvestmentsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/investments/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/investments/`; }; var getInvestments = async (params, options) => { const res = await fetch(getGetInvestmentsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetInvestmentsIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/investments/${id}/`; }; var getInvestmentsId = async (id, options) => { const res = await fetch(getGetInvestmentsIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetPositionsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/positions/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/positions/`; }; var getPositions = async (params, options) => { const res = await fetch(getGetPositionsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetPositionsIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/positions/${id}/`; }; var getPositionsId = async (id, options) => { const res = await fetch(getGetPositionsIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetAgreementsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/agreements/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/agreements/`; }; var getAgreements = async (params, options) => { const res = await fetch(getGetAgreementsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetAgreementsIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/agreements/${id}/`; }; var getAgreementsId = async (id, options) => { const res = await fetch(getGetAgreementsIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetNonInvestmentIncomeUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/non-investment-income/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/non-investment-income/`; }; var getNonInvestmentIncome = async (params, options) => { const res = await fetch(getGetNonInvestmentIncomeUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetNonInvestmentIncomeIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/non-investment-income/${id}/`; }; var getNonInvestmentIncomeId = async (id, options) => { const res = await fetch(getGetNonInvestmentIncomeIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetSpouseIncomeUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/spouse-income/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/spouse-income/`; }; var getSpouseIncome = async (params, options) => { const res = await fetch(getGetSpouseIncomeUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetSpouseIncomeIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/spouse-income/${id}/`; }; var getSpouseIncomeId = async (id, options) => { const res = await fetch(getGetSpouseIncomeIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetReimbursementsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/reimbursements/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/reimbursements/`; }; var getReimbursements = async (params, options) => { const res = await fetch(getGetReimbursementsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetReimbursementsIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/reimbursements/${id}/`; }; var getReimbursementsId = async (id, options) => { const res = await fetch(getGetReimbursementsIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetGiftsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/gifts/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/gifts/`; }; var getGifts = async (params, options) => { const res = await fetch(getGetGiftsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetGiftsIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/gifts/${id}/`; }; var getGiftsId = async (id, options) => { const res = await fetch(getGetGiftsIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetDebtsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/debts/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/debts/`; }; var getDebts = async (params, options) => { const res = await fetch(getGetDebtsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetDebtsIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/debts/${id}/`; }; var getDebtsId = async (id, options) => { const res = await fetch(getGetDebtsIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetAlertsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/alerts/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/alerts/`; }; var getAlerts = async (params, options) => { const res = await fetch(getGetAlertsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getPostAlertsUrl = () => { return `https://www.courtlistener.com/api/rest/v4/alerts/`; }; var postAlerts = async (postAlertsBody, options) => { const res = await fetch(getPostAlertsUrl(), { ...options, method: "POST", headers: { "Content-Type": "application/json", ...options?.headers }, body: JSON.stringify(postAlertsBody) }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetProcessingQueueUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/processing-queue/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/processing-queue/`; }; var getProcessingQueue = async (params, options) => { const res = await fetch(getGetProcessingQueueUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetRecapUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/recap/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/recap/`; }; var getRecap = async (params, options) => { const res = await fetch(getGetRecapUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetRecapIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/recap/${id}/`; }; var getRecapId = async (id, options) => { const res = await fetch(getGetRecapIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetPacerDocIdsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/pacer-doc-ids/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/pacer-doc-ids/`; }; var getPacerDocIds = async (params, options) => { const res = await fetch(getGetPacerDocIdsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getPostRecapFetchUrl = () => { return `https://www.courtlistener.com/api/rest/v4/recap-fetch/`; }; var postRecapFetch = async (postRecapFetchBody, options) => { const res = await fetch(getPostRecapFetchUrl(), { ...options, method: "POST", headers: { "Content-Type": "application/json", ...options?.headers }, body: JSON.stringify(postRecapFetchBody) }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetDocketAlertsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/docket-alerts/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/docket-alerts/`; }; var getDocketAlerts = async (params, options) => { const res = await fetch(getGetDocketAlertsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getPostDocketAlertsUrl = () => { return `https://www.courtlistener.com/api/rest/v4/docket-alerts/`; }; var postDocketAlerts = async (postDocketAlertsBody, options) => { const res = await fetch(getPostDocketAlertsUrl(), { ...options, method: "POST", headers: { "Content-Type": "application/json", ...options?.headers }, body: JSON.stringify(postDocketAlertsBody) }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetOriginalProceedingsPanelsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/original-proceedings-panels/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/original-proceedings-panels/`; }; var getOriginalProceedingsPanels = async (params, options) => { const res = await fetch(getGetOriginalProceedingsPanelsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetJudgePositionsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/judge-positions/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/judge-positions/`; }; var getJudgePositions = async (params, options) => { const res = await fetch(getGetJudgePositionsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetJudgePositionsIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/judge-positions/${id}/`; }; var getJudgePositionsId = async (id, options) => { const res = await fetch(getGetJudgePositionsIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetSchoolsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/schools/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/schools/`; }; var getSchools = async (params, options) => { const res = await fetch(getGetSchoolsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetSchoolsIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/schools/${id}/`; }; var getSchoolsId = async (id, options) => { const res = await fetch(getGetSchoolsIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetPoliticalAffiliationsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/political-affiliations/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/political-affiliations/`; }; var getPoliticalAffiliations = async (params, options) => { const res = await fetch(getGetPoliticalAffiliationsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetPoliticalAffiliationsIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/political-affiliations/${id}/`; }; var getPoliticalAffiliationsId = async (id, options) => { const res = await fetch(getGetPoliticalAffiliationsIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetCitationsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/citations/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/citations/`; }; var getCitations = async (params, options) => { const res = await fetch(getGetCitationsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetCitationsIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/citations/${id}/`; }; var getCitationsId = async (id, options) => { const res = await fetch(getGetCitationsIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetVisualizationsUrl = (params) => { const normalizedParams = new URLSearchParams; Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : value.toString()); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `https://www.courtlistener.com/api/rest/v4/visualizations/?${stringifiedParams}` : `https://www.courtlistener.com/api/rest/v4/visualizations/`; }; var getVisualizations = async (params, options) => { const res = await fetch(getGetVisualizationsUrl(params), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; var getGetVisualizationsIdUrl = (id) => { return `https://www.courtlistener.com/api/rest/v4/visualizations/${id}/`; }; var getVisualizationsId = async (id, options) => { const res = await fetch(getGetVisualizationsIdUrl(id), { ...options, method: "GET" }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers }; }; // src/mcp/handlers.ts var getHandler = async () => { const res = await get(); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getSearchHandler = async (args) => { const res = await getSearch(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var postCitationLookupHandler = async (args) => { const res = await postCitationLookup(args.bodyParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getDocketsHandler = async (args) => { const res = await getDockets(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getDocketsIdHandler = async (args) => { const res = await getDocketsId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getClustersHandler = async (args) => { const res = await getClusters(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getClustersIdHandler = async (args) => { const res = await getClustersId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getOpinionsHandler = async (args) => { const res = await getOpinions(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getOpinionsIdHandler = async (args) => { const res = await getOpinionsId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getCourtsHandler = async (args) => { const res = await getCourts(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getCourtsIdHandler = async (args) => { const res = await getCourtsId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getPeopleHandler = async (args) => { const res = await getPeople(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getPeopleIdHandler = async (args) => { const res = await getPeopleId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getAudioHandler = async (args) => { const res = await getAudio(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getAudioIdHandler = async (args) => { const res = await getAudioId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getFinancialDisclosuresHandler = async (args) => { const res = await getFinancialDisclosures(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getFinancialDisclosuresIdHandler = async (args) => { const res = await getFinancialDisclosuresId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getInvestmentsHandler = async (args) => { const res = await getInvestments(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getInvestmentsIdHandler = async (args) => { const res = await getInvestmentsId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getPositionsHandler = async (args) => { const res = await getPositions(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getPositionsIdHandler = async (args) => { const res = await getPositionsId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getAgreementsHandler = async (args) => { const res = await getAgreements(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getAgreementsIdHandler = async (args) => { const res = await getAgreementsId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getNonInvestmentIncomeHandler = async (args) => { const res = await getNonInvestmentIncome(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getNonInvestmentIncomeIdHandler = async (args) => { const res = await getNonInvestmentIncomeId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getSpouseIncomeHandler = async (args) => { const res = await getSpouseIncome(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getSpouseIncomeIdHandler = async (args) => { const res = await getSpouseIncomeId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getReimbursementsHandler = async (args) => { const res = await getReimbursements(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getReimbursementsIdHandler = async (args) => { const res = await getReimbursementsId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getGiftsHandler = async (args) => { const res = await getGifts(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getGiftsIdHandler = async (args) => { const res = await getGiftsId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getDebtsHandler = async (args) => { const res = await getDebts(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getDebtsIdHandler = async (args) => { const res = await getDebtsId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getAlertsHandler = async (args) => { const res = await getAlerts(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var postAlertsHandler = async (args) => { const res = await postAlerts(args.bodyParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getProcessingQueueHandler = async (args) => { const res = await getProcessingQueue(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getRecapHandler = async (args) => { const res = await getRecap(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getRecapIdHandler = async (args) => { const res = await getRecapId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getPacerDocIdsHandler = async (args) => { const res = await getPacerDocIds(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var postRecapFetchHandler = async (args) => { const res = await postRecapFetch(args.bodyParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getDocketAlertsHandler = async (args) => { const res = await getDocketAlerts(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var postDocketAlertsHandler = async (args) => { const res = await postDocketAlerts(args.bodyParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getOriginalProceedingsPanelsHandler = async (args) => { const res = await getOriginalProceedingsPanels(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getJudgePositionsHandler = async (args) => { const res = await getJudgePositions(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getJudgePositionsIdHandler = async (args) => { const res = await getJudgePositionsId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getSchoolsHandler = async (args) => { const res = await getSchools(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getSchoolsIdHandler = async (args) => { const res = await getSchoolsId(args.pathParams.id); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getPoliticalAffiliationsHandler = async (args) => { const res = await getPoliticalAffiliations(args.queryParams); return { content: [ { type: "text", text: JSON.stringify(res) } ] }; }; var getPoliticalAffiliationsIdHandler = async (args) => { const res = await getPoliticalAffiliationsId(args.pathParams.