paper_health
Check availability of academic paper download sources including Unpaywall, arXiv, and Sci-Hub mirrors to verify service health for research access.
Instructions
检查论文下载服务各数据源的可用性(Unpaywall、arXiv、Sci-Hub 镜像)。
Returns: 各数据源健康状态的 JSON 字符串
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- scholar_mcp_server.py:244-252 (handler)Tool registration and handler wrapper for paper_health in the MCP server.
@mcp.tool() def paper_health() -> str: """检查论文下载服务各数据源的可用性(Unpaywall、arXiv、Sci-Hub 镜像)。 Returns: 各数据源健康状态的 JSON 字符串 """ result = health_check() return json.dumps(result, ensure_ascii=False, indent=2) - downloader.py:373-400 (helper)The core business logic that executes the health check for the paper health tool.
def health_check() -> dict: """检查各下载源的可用性""" status = {"overall": "ok", "sources": {}} # 检查 Unpaywall try: r = requests.get( f"https://api.unpaywall.org/v2/10.1038/nature12373?email={UNPAYWALL_EMAIL}", timeout=10, ) status["sources"]["unpaywall"] = "ok" if r.status_code == 200 else f"http_{r.status_code}" except Exception as e: status["sources"]["unpaywall"] = f"error: {str(e)[:60]}" # 检查 arXiv try: r = requests.head(f"{ARXIV_PDF_BASE}2301.00001", timeout=10, allow_redirects=True) status["sources"]["arxiv"] = "ok" if r.status_code == 200 else f"http_{r.status_code}" except Exception as e: status["sources"]["arxiv"] = f"error: {str(e)[:60]}" # 检查 Sci-Hub 镜像 scihub_status = {} for mirror in SCIHUB_MIRRORS: try: r = requests.get(mirror, timeout=10) scihub_status[mirror] = "ok" if r.status_code == 200 else f"http_{r.status_code}" except Exception as e: