libofcongress-mcp-server
Search LOC digital collections, Chronicling America newspapers (full OCR), and LC Subject Headings.
我该使用它吗
质量与安全性
发现(3)
- LOW在 libofcongress_search_newspapers 中
- LOW在 libofcongress_get_newspaper_page 中
- LOW在 libofcongress_browse_collections 中
基于对工具定义和协议合规性的自动分析。
上下文开销
这是每次将服务器的工具加载到模型上下文窗口时所消耗的大致 token 数。数值越高,可用于其他任务的注意力就越少。
安装
一键安装
将以下内容添加到你的 `claude_desktop_config.json` 文件中:
{
"mcpServers": {
"libofcongress-mcp-server": {
"command": "bun",
"args": [
"@cyanheads/libofcongress-mcp-server"
]
}
}
}可运行的软件包
0.3.0streamable-http远程端点
https://libofcongress.caseyjhand.com/mcpstreamable-http它能做什么
工具清单
工具(6)
🟢libofcongress_search(query, format, date_start, date_end, subject, ...)
Search the Library of Congress digital collections by keyword. Optionally filter by material format (photos, maps, newspapers, audio, etc.), date range, subject heading, or geographic location, or scope the search to a single curated collection with collection_slug. Returns item summaries with titles, dates, descriptions, LOC IDs, and format tags. Each result carries is_item: pass the id of a result where is_item is true to libofcongress_get_item for full metadata; results where is_item is false are non-item resources (collections, exhibit and research-guide pages, newspaper-page results) with no item record — open their url instead. Use libofcongress_search_subjects first to find the exact LCSH heading spelling before applying a subject filter.
输入模式
{
"type": "object",
"properties": {
"query": {
"type": "string",
"minLength": 1,
"description": "Full-text search across metadata and available descriptive text."
},
"format": {
"description": "Material type filter. Options: photo, map, newspaper, manuscript, audio, film, book, notated-music. Omit to search all formats.",
"type": "string",
"enum": [
"photo",
"map",
"newspaper",
"manuscript",
"audio",
"film",
"book",
"notated-music"
]
},
"date_start": {
"description": "Start year for date filter, inclusive (e.g., 1920). Omit for no lower bound.",
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"date_end": {
"description": "End year for date filter, inclusive (e.g., 1930). Omit for no upper bound.",
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"subject": {
"description": "Subject heading filter. Use the exact label from libofcongress_search_subjects results for best precision. Example: \"World War, 1939-1945\".",
"type": "string"
},
"location": {
"description": "Geographic location filter (e.g., \"oklahoma\", \"washington d.c.\"). Lowercase, matches LOC location facets.",
"type": "string"
},
"collection_slug": {
"description": "Scope the search to one curated collection. Use a slug exactly as returned by libofcongress_browse_collections (e.g., \"aaron-copland\") — slugs are not derivable from the collection title. Cannot be combined with format; omit format and read each result's format field instead. Omit to search all of LOC.",
"type": "string"
},
"limit": {
"default": 25,
"description": "Results per page. Default 25, max 100.",
"type": "integer",
"minimum": 1,
"maximum": 100
},
"page": {
"default": 1,
"description": "1-indexed page number for paginating results.",
"type": "integer",
"minimum": 1,
"maximum": 9007199254740991
}
},
"required": [
"query"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}输出模式
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "LOC identifier for this result. When is_item is true, pass it to libofcongress_get_item for full metadata. When is_item is false it is a non-item resource (a collection, exhibit, guide, or newspaper page), not a get_item input — open url instead."
},
"title": {
"type": "string",
"description": "Item title."
},
"date": {
"description": "Publication or creation date.",
"type": "string"
},
"description": {
"description": "Brief description or summary.",
"type": "string"
},
"format": {
"description": "Material format (e.g., photo, map, manuscript, collection).",
"type": "string"
},
"is_item": {
"type": "boolean",
"description": "True when this result is a catalog item whose id resolves through libofcongress_get_item. False for collections, exhibits, research guides, newspaper pages, and other non-item results, which have no get_item record — follow url instead. Always present on every result."
},
"url": {
"type": "string",
"description": "LOC item or collection URL."
}
},
"required": [
"id",
"title",
"is_item",
"url"
],
"additionalProperties": false,
"description": "A single LOC item summary."
},
"description": "Item summaries matching the search query and filters."
},
"total": {
"type": "number",
"description": "Total number of matching items across all pages."
},
"page": {
"type": "number",
"description": "Current 1-indexed page number."
},
"pages": {
"type": "number",
"description": "Total retrievable pages. For result sets larger than LOC will page through (~100,000 items) this is capped, and a notice discloses how to reach the rest (partition by date/subject/location)."
},
"has_next": {
"type": "boolean",
"description": "True when a retrievable next page follows this one. Never promises a page past LOC's ~100,000-item retrieval ceiling."
},
"effectiveQuery": {
"type": "string",
"description": "The query as submitted to the LOC API, after trimming."
},
"effectiveCollectionSlug": {
"description": "The collection the search was scoped to, after trimming. Absent when the search covered all of LOC.",
"type": "string"
},
"totalCount": {
"type": "number",
"description": "Total matching items across all pages — mirrors output.total for agent reasoning."
},
"notice": {
"description": "Recovery hint when results are empty or a page is out of range — echoes applied filters and suggests how to broaden. Absent on successful result pages.",
"type": "string"
},
"error": {
"description": "Present when the call failed. Absent on success.",
"type": "object",
"properties": {
"code": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"description": "Machine-readable failure mode. Declared by this tool: `invalid_date_range`: date_start is later than date_end. `incompatible_filters`: format and collection_slug were both supplied; each selects a different LOC endpoint, so only one can apply. `collection_not_found`: collection_slug does not resolve to a LOC collection. Reported on page 1; a later page gets the out-of-range notice, since LOC answers both cases the same way there. `rate_limit_exceeded`: LOC API rate limit exceeded; requests are blocked for approximately 1 hour. Other values are possible when a failure originates below the handler.",
"examples": [
"invalid_date_range",
"incompatible_filters",
"collection_not_found",
"rate_limit_exceeded"
]
},
"recovery": {
"description": "Actionable next step for the caller.",
"type": "object",
"properties": {
"hint": {
"type": "string"
}
},
"required": [
"hint"
],
"additionalProperties": {}
},
"retryable": {
"description": "Whether retrying may succeed.",
"type": "boolean"
}
},
"additionalProperties": {}
}
},
"required": [
"code",
"message"
],
"additionalProperties": {}
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"items",
"total",
"page",
"pages",
"has_next",
"effectiveQuery",
"totalCount"
]
},
{
"required": [
"error"
]
}
]
}🟢libofcongress_get_item(item_id)
Retrieve the full metadata record for a specific LOC digital item. Returns contributors, subjects, summary, languages, locations, rights information, physical description, call number, original and online formats, access restrictions, former catalog IDs, notes, related items, and links to digital resources (TIFF, JPEG, PDF) for items with digital surrogates. Use after libofcongress_search on a result whose is_item is true. Pass the result id verbatim — it may be a simple ID or a slash-separated newspaper path; do not prepend the loc.gov URL. Non-item results (is_item: false) — collections, exhibits, guides, newspaper pages — have no item record and cannot be retrieved here.
输入模式
{
"type": "object",
"properties": {
"item_id": {
"type": "string",
"minLength": 1,
"description": "LOC item id from a libofcongress_search result's \"id\" field (where is_item is true). A simple ID (\"2009632251\", \"2005691065\") or a slash-separated path for newspaper pages (\"sn95047246/1935-09-05/ed-1\"). Pass the id verbatim; do not prepend the loc.gov URL or an \"item/\" prefix."
}
},
"required": [
"item_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}输出模式
{
"type": "object",
"properties": {
"item_id": {
"type": "string",
"description": "LOC item ID as resolved by the service (matches the input item_id)."
},
"title": {
"type": "string",
"description": "Item title."
},
"date": {
"description": "Publication or creation date.",
"type": "string"
},
"contributors": {
"type": "array",
"items": {
"type": "string"
},
"description": "Contributors, creators, or photographers as LOC catalogs them, role included (e.g., \"Washington, George, 1732-1799 (Author)\"). One person can appear once per role. Empty when LOC lists none."
},
"subject_headings": {
"type": "array",
"items": {
"type": "string"
},
"description": "LCSH subject headings assigned to this item."
},
"notes": {
"type": "array",
"items": {
"type": "string"
},
"description": "Descriptive notes and annotations from catalogers."
},
"summary": {
"description": "Cataloger's abstract of the item's subject and historical context.",
"type": "string"
},
"rights_information": {
"description": "Rights and reproduction statement for this item.",
"type": "string"
},
"physical_description": {
"description": "Physical or technical description of the original item.",
"type": "string"
},
"call_number": {
"description": "LOC call number — the shelf location for requesting the physical original.",
"type": "string"
},
"languages": {
"type": "array",
"items": {
"type": "string"
},
"description": "Languages of the item (e.g., \"english\")."
},
"locations": {
"type": "array",
"items": {
"type": "string"
},
"description": "Places the item depicts or originates from (e.g., \"united states\")."
},
"former_ids": {
"type": "array",
"items": {
"type": "string"
},
"description": "Superseded catalog identifiers or URLs this item was previously known by."
},
"original_formats": {
"type": "array",
"items": {
"type": "string"
},
"description": "Material types of the original (e.g., \"photo, print, drawing\")."
},
"online_formats": {
"type": "array",
"items": {
"type": "string"
},
"description": "Formats the digitized surrogate is available in (e.g., \"image\")."
},
"access_restricted": {
"description": "True when LOC restricts access to the original. Absent when upstream omits it.",
"type": "boolean"
},
"resource_links": {
"type": "array",
"items": {
"type": "string"
},
"description": "URLs to downloadable digital files (TIFF, JPEG, PDF). Empty when no digital surrogate exists."
},
"related_items": {
"type": "array",
"items": {
"type": "string"
},
"description": "IDs or URLs of related LOC records for follow-up retrieval; a title stands in for a related record LOC gives neither for."
},
"url": {
"type": "string",
"description": "Canonical LOC item URL."
},
"error": {
"description": "Present when the call failed. Absent on success.",
"type": "object",
"properties": {
"code": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"description": "Machine-readable failure mode. Declared by this tool: `item_not_found`: No item exists for the given ID. `rate_limit_exceeded`: LOC API rate limit exceeded; requests are blocked for approximately 1 hour. Other values are possible when a failure originates below the handler.",
"examples": [
"item_not_found",
"rate_limit_exceeded"
]
},
"recovery": {
"description": "Actionable next step for the caller.",
"type": "object",
"properties": {
"hint": {
"type": "string"
}
},
"required": [
"hint"
],
"additionalProperties": {}
},
"retryable": {
"description": "Whether retrying may succeed.",
"type": "boolean"
}
},
"additionalProperties": {}
}
},
"required": [
"code",
"message"
],
"additionalProperties": {}
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"item_id",
"title",
"contributors",
"subject_headings",
"notes",
"languages",
"locations",
"former_ids",
"original_formats",
"online_formats",
"resource_links",
"related_items",
"url"
]
},
{
"required": [
"error"
]
}
]
}🟢libofcongress_search_newspapers(query, date_start, date_end, state, newspaper_title, ...)
Search historical newspaper pages in the Chronicling America corpus. Returns matching pages with OCR text excerpts (~500 characters), publication title, date, the states LOC indexes the title under, and the page URL needed for libofcongress_get_newspaper_page. Filters by keyword, date range, US state, and newspaper title. The OCR excerpts are sufficient for relevance assessment — call libofcongress_get_newspaper_page with the returned url field to read the full page text. OCR quality varies: 19th-century and degraded materials may contain fragmented or garbled text.
输入模式
{
"type": "object",
"properties": {
"query": {
"type": "string",
"minLength": 1,
"description": "Keyword search across OCR text and newspaper metadata."
},
"date_start": {
"description": "Start year for date filter, inclusive (e.g., 1900). Omit for no lower bound.",
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"date_end": {
"description": "End year for date filter, inclusive (e.g., 1920). Omit for no upper bound.",
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"state": {
"description": "Filter to newspapers published in this US state. Use the full state name, lowercase (e.g., \"oklahoma\", \"new york\").",
"type": "string"
},
"newspaper_title": {
"description": "Filter to a specific newspaper by title (partial match accepted).",
"type": "string"
},
"limit": {
"default": 25,
"description": "Results per page. Default 25, max 100.",
"type": "integer",
"minimum": 1,
"maximum": 100
},
"page": {
"default": 1,
"description": "1-indexed page number for paginating results.",
"type": "integer",
"minimum": 1,
"maximum": 9007199254740991
}
},
"required": [
"query"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}输出模式
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "LOC resource URL for this page — pass to libofcongress_get_newspaper_page to get full OCR text."
},
"title": {
"type": "string",
"description": "Page or issue title."
},
"description": {
"description": "OCR text excerpt (~500 chars) for relevance assessment.",
"type": "string"
},
"date": {
"description": "Issue publication date.",
"type": "string"
},
"states": {
"description": "Every US state LOC indexes this newspaper title under (e.g., [\"georgia\", \"south carolina\"]), in LOC order. A title indexed against its circulation area lists several, so no entry is necessarily the place of publication — libofcongress_get_newspaper_page returns place_of_publication. Absent when LOC lists no state.",
"type": "array",
"items": {
"type": "string"
}
},
"newspaper_title": {
"description": "Newspaper publication title.",
"type": "string"
}
},
"required": [
"url",
"title"
],
"additionalProperties": false,
"description": "A single newspaper page search result."
},
"description": "Newspaper page results matching the search query and filters."
},
"total": {
"type": "number",
"description": "Total number of matching newspaper pages in the result set."
},
"page": {
"type": "number",
"description": "Current 1-indexed page number."
},
"pages": {
"type": "number",
"description": "Total retrievable pages. For result sets larger than LOC will page through (~100,000 pages) this is capped, and a notice discloses how to reach the rest (partition by date/state)."
},
"has_next": {
"type": "boolean",
"description": "True when a retrievable next page follows this one. Never promises a page past LOC's ~100,000-item retrieval ceiling."
},
"effectiveQuery": {
"type": "string",
"description": "The keyword query as submitted to the Chronicling America API, after trimming."
},
"totalCount": {
"type": "number",
"description": "Total matching newspaper pages — mirrors output.total for agent reasoning."
},
"notice": {
"description": "Recovery hint when results are empty or a page is out of range — echoes applied filters and suggests how to broaden. Absent on successful result pages.",
"type": "string"
},
"error": {
"description": "Present when the call failed. Absent on success.",
"type": "object",
"properties": {
"code": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"description": "Machine-readable failure mode. Declared by this tool: `invalid_date_range`: date_start is later than date_end. `rate_limit_exceeded`: LOC API rate limit exceeded; requests are blocked for approximately 1 hour. Other values are possible when a failure originates below the handler.",
"examples": [
"invalid_date_range",
"rate_limit_exceeded"
]
},
"recovery": {
"description": "Actionable next step for the caller.",
"type": "object",
"properties": {
"hint": {
"type": "string"
}
},
"required": [
"hint"
],
"additionalProperties": {}
},
"retryable": {
"description": "Whether retrying may succeed.",
"type": "boolean"
}
},
"additionalProperties": {}
}
},
"required": [
"code",
"message"
],
"additionalProperties": {}
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"items",
"total",
"page",
"pages",
"has_next",
"effectiveQuery",
"totalCount"
]
},
{
"required": [
"error"
]
}
]
}🟢libofcongress_get_newspaper_page(page_url)
Retrieve the full OCR text of a specific historical newspaper page along with publication metadata — newspaper title, issue date, place of publication, indexed states, edition, the page's sequence, and the issue's page count. Pass the url field from a libofcongress_search_newspapers result — do not construct this URL manually. OCR quality varies by digitization batch and era: 19th-century and degraded materials may contain fragmented text, garbled words, and line-break artifacts that are surfaced as-is. When a page exists but has no digitized text, ocr_available is false and ocr_text is empty — this is a data property, not an error.
输入模式
{
"type": "object",
"properties": {
"page_url": {
"type": "string",
"description": "The url field from a libofcongress_search_newspapers result (e.g., \"https://www.loc.gov/resource/sn83045462/1905-03-15/ed-1/seq-1/\"). Always pass the value directly from search results — do not construct or modify this URL."
}
},
"required": [
"page_url"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}输出模式
{
"type": "object",
"properties": {
"page_url": {
"type": "string",
"description": "The LOC resource URL for this newspaper page."
},
"newspaper_title": {
"description": "Title of the newspaper publication. Absent when LOC gives none.",
"type": "string"
},
"date": {
"description": "Issue publication date (YYYY-MM-DD).",
"type": "string"
},
"states": {
"description": "Every US state LOC indexes this newspaper title under (e.g., [\"georgia\", \"south carolina\"]), in LOC order — possibly more than the state of publication. Absent when LOC lists no state.",
"type": "array",
"items": {
"type": "string"
}
},
"place_of_publication": {
"description": "Where the newspaper was published, as LOC catalogs it (e.g., \"Charleston, S.C.\"). Absent when LOC gives none.",
"type": "string"
},
"edition": {
"description": "Edition number of the issue (e.g., \"1\"). Absent when LOC gives none.",
"type": "string"
},
"sequence": {
"description": "Page sequence number within the issue.",
"type": "number"
},
"segment_count": {
"description": "Number of pages in the issue. Absent when LOC gives none.",
"type": "number"
},
"ocr_text": {
"type": "string",
"description": "Full plain-text OCR content for the page. Empty string when ocr_available is false. May contain fragmented words, line-break artifacts, and misspellings inherent to historical OCR — do not attempt to repair."
},
"ocr_available": {
"type": "boolean",
"description": "True when digitized OCR text exists for this page. False for image-only digitization batches where OCR has not been applied."
},
"notice": {
"description": "Set when ocr_available is true but ocr_text is empty — the page has digitized OCR, but the text service did not return it this call. Distinguishes a transient retrieval miss from a genuinely image-only page (where ocr_available is false). Absent when OCR text was returned or the page has no OCR.",
"type": "string"
},
"error": {
"description": "Present when the call failed. Absent on success.",
"type": "object",
"properties": {
"code": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"description": "Machine-readable failure mode. Declared by this tool: `invalid_page_url`: page_url does not begin with https://www.loc.gov/resource/. `page_not_found`: The URL does not resolve to a valid LOC newspaper page resource. `rate_limit_exceeded`: LOC API rate limit exceeded; requests are blocked for approximately 1 hour. Other values are possible when a failure originates below the handler.",
"examples": [
"invalid_page_url",
"page_not_found",
"rate_limit_exceeded"
]
},
"recovery": {
"description": "Actionable next step for the caller.",
"type": "object",
"properties": {
"hint": {
"type": "string"
}
},
"required": [
"hint"
],
"additionalProperties": {}
},
"retryable": {
"description": "Whether retrying may succeed.",
"type": "boolean"
}
},
"additionalProperties": {}
}
},
"required": [
"code",
"message"
],
"additionalProperties": {}
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"page_url",
"ocr_text",
"ocr_available"
]
},
{
"required": [
"error"
]
}
]
}🟢libofcongress_search_subjects(query, limit)
Search Library of Congress Subject Headings (LCSH) by keyword. Returns controlled-vocabulary subject labels and their URIs. Use the returned label as the subject filter in libofcongress_search — LCSH uses precise, standardized terms that differ from natural language (e.g., "World War, 1939-1945" not "World War II"; "Photography, Aerial" not "Aerial photography"). Running this tool before a subject-filtered libofcongress_search dramatically improves result quality.
输入模式
{
"type": "object",
"properties": {
"query": {
"type": "string",
"minLength": 1,
"description": "Keyword or partial subject heading to search for (e.g., \"civil war\", \"immigration\", \"jazz\")."
},
"limit": {
"default": 10,
"description": "Maximum number of subject headings to return. Default 10, max 50.",
"type": "integer",
"minimum": 1,
"maximum": 50
}
},
"required": [
"query"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}输出模式
{
"type": "object",
"properties": {
"subjects": {
"type": "array",
"items": {
"type": "object",
"properties": {
"label": {
"type": "string",
"description": "Standardized LCSH heading — use this exact string in the libofcongress_search subject filter."
},
"uri": {
"type": "string",
"description": "Stable LOC URI identifying this subject heading in the authority file."
}
},
"required": [
"label",
"uri"
],
"additionalProperties": false,
"description": "A single LCSH subject heading record."
},
"description": "LCSH subject headings matching the query, ordered by relevance. To see how many LOC items carry a heading, pass its label as the libofcongress_search subject filter and read total."
},
"total": {
"type": "number",
"description": "Number of subject headings returned."
},
"effectiveQuery": {
"type": "string",
"description": "The keyword query as submitted to the id.loc.gov suggest endpoint, after trimming."
},
"truncated": {
"description": "True when results were capped at the requested limit. Increase limit or refine the query to surface additional headings.",
"type": "boolean"
},
"shown": {
"description": "Number of subject headings returned in this response.",
"type": "number"
},
"cap": {
"description": "The limit applied to this response — maximum headings the API will return.",
"type": "number"
},
"notice": {
"description": "Recovery hint when results are empty, or when the upstream candidate cap under-filled the request. Distinguishes \"exhausted by ranking\" (retry with a more specific query) from \"no LCSH coverage\", and suggests inverted-form strategies. Absent when the full requested set was returned.",
"type": "string"
},
"error": {
"description": "Present when the call failed. Absent on success.",
"type": "object",
"properties": {
"code": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"description": "Machine-readable failure mode."
},
"recovery": {
"description": "Actionable next step for the caller.",
"type": "object",
"properties": {
"hint": {
"type": "string"
}
},
"required": [
"hint"
],
"additionalProperties": {}
},
"retryable": {
"description": "Whether retrying may succeed.",
"type": "boolean"
}
},
"additionalProperties": {}
}
},
"required": [
"code",
"message"
],
"additionalProperties": {}
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"subjects",
"total",
"effectiveQuery"
]
},
{
"required": [
"error"
]
}
]
}🟢libofcongress_browse_collections(query, limit, page)
List and browse Library of Congress curated digital collections. Returns collection names, descriptions, item counts, slugs, and URLs. Optionally filter by keyword. Collections are curated subsets of the digital holdings with specific focuses (e.g., "Civil War Glass Negatives", "Baseball Cards", "WPA Posters"). Use the returned URL to navigate directly to a collection on loc.gov.
输入模式
{
"type": "object",
"properties": {
"query": {
"description": "Optional keyword to filter collections by name or description. Omit to list all collections.",
"type": "string"
},
"limit": {
"default": 25,
"description": "Maximum number of collections to return. Default 25, max 100.",
"type": "integer",
"minimum": 1,
"maximum": 100
},
"page": {
"default": 1,
"description": "1-indexed page number for paginating results.",
"type": "integer",
"minimum": 1,
"maximum": 9007199254740991
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}输出模式
{
"type": "object",
"properties": {
"collections": {
"type": "array",
"items": {
"type": "object",
"properties": {
"slug": {
"type": "string",
"description": "Collection URL slug — identifies the collection within loc.gov URLs."
},
"title": {
"type": "string",
"description": "Collection name."
},
"description": {
"description": "Description of the collection's scope and contents.",
"type": "string"
},
"item_count": {
"description": "Approximate number of items in this collection. Omitted when unavailable.",
"type": "number"
},
"url": {
"type": "string",
"description": "Collection URL on loc.gov."
}
},
"required": [
"slug",
"title",
"url"
],
"additionalProperties": false,
"description": "A single LOC curated digital collection."
},
"description": "LOC curated collections matching the keyword filter, or all collections when no keyword is specified."
},
"total": {
"type": "number",
"description": "Total number of matching collections across all pages."
},
"page": {
"type": "number",
"description": "Current 1-indexed page number."
},
"pages": {
"type": "number",
"description": "Total number of pages available."
},
"has_next": {
"type": "boolean",
"description": "True when more pages are available after this one."
},
"totalCount": {
"type": "number",
"description": "Total matching collections — mirrors output.total for agent reasoning."
},
"notice": {
"description": "Recovery hint when results are empty or a page is out of range — suggests broadening the keyword or removing filters. Absent on successful result pages.",
"type": "string"
},
"error": {
"description": "Present when the call failed. Absent on success.",
"type": "object",
"properties": {
"code": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"description": "Machine-readable failure mode. Declared by this tool: `rate_limit_exceeded`: LOC API rate limit exceeded; requests are blocked for approximately 1 hour. Other values are possible when a failure originates below the handler.",
"examples": [
"rate_limit_exceeded"
]
},
"recovery": {
"description": "Actionable next step for the caller.",
"type": "object",
"properties": {
"hint": {
"type": "string"
}
},
"required": [
"hint"
],
"additionalProperties": {}
},
"retryable": {
"description": "Whether retrying may succeed.",
"type": "boolean"
}
},
"additionalProperties": {}
}
},
"required": [
"code",
"message"
],
"additionalProperties": {}
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"collections",
"total",
"page",
"pages",
"has_next",
"totalCount"
]
},
{
"required": [
"error"
]
}
]
}社区
证据