get_papers
Retrieve a researcher's publications with citation counts from Semantic Scholar and Google Scholar, providing titles, years, and URLs for academic analysis.
Instructions
Get a researcher's publications with citation counts.
Args: slug: Researcher identifier.
Returns papers from Semantic Scholar and Google Scholar (merged, deduplicated) with titles, years, citation counts, and URLs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes |
Implementation Reference
- The get_papers tool handler function. Takes a researcher slug parameter, fetches papers from the ResearchTwin API endpoint /api/researcher/{slug}/papers, and returns a formatted markdown list of publications with years and citation counts.
@mcp.tool(annotations=ToolAnnotations(title="Get Papers", read_only_hint=True)) async def get_papers(slug: str) -> str: """Get a researcher's publications with citation counts. Args: slug: Researcher identifier. Returns papers from Semantic Scholar and Google Scholar (merged, deduplicated) with titles, years, citation counts, and URLs. """ data = await _get(f"/api/researcher/{slug}/papers") items = data.get("items", []) if not items: return f"No papers found for {slug}." lines = [] for p in items[:20]: year = p.get("year") or "?" cites = p.get("citations", 0) lines.append(f"- [{year}] **{p['title']}** ({cites} citations)") return f"**{data.get('total', len(items))} papers for {slug}:**\n" + "\n".join(lines) - The _get helper function used by get_papers (and other tools) to make HTTP GET requests to the ResearchTwin API with proper timeout handling.
async def _get(path: str, params: dict | None = None) -> dict: """Make a GET request to the ResearchTwin API.""" async with httpx.AsyncClient(timeout=TIMEOUT) as client: resp = await client.get(f"{BASE_URL}{path}", params=params) resp.raise_for_status() return resp.json() - Import of httpx for HTTP requests and MCP framework components including FastMCP and ToolAnnotations which define the tool's metadata and schema annotations.
import httpx from mcp.server import FastMCP from mcp.types import ToolAnnotations