bc_get_biorxiv_preprint_details
Retrieve detailed preprint metadata from bioRxiv or medRxiv using DOI to access title, authors, abstract, publication date, version, category, and license information.
Instructions
Get detailed preprint metadata by DOI. Retrieves title, authors, abstract, date, version, category, license, and publication status.
Returns: dict: Preprint metadata including doi, title, authors, abstract, date, version, category, license, publication status or error message.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doi | Yes | Preprint DOI (e.g., '10.1101/2020.09.09.20191205') | |
| server | No | 'biorxiv' or 'medrxiv' | biorxiv |
Implementation Reference
- The handler function get_biorxiv_preprint_details decorated with @core_mcp.tool(), implementing the core logic to retrieve preprint details from bioRxiv or medRxiv APIs using their details endpoint. Includes input validation, DOI cleaning, API request, and structured response parsing.@core_mcp.tool() def get_biorxiv_preprint_details( doi: Annotated[str, Field(description="Preprint DOI (e.g., '10.1101/2020.09.09.20191205')")], server: Annotated[str, Field(description="'biorxiv' or 'medrxiv'")] = "biorxiv", ) -> Dict[str, Any]: """Get detailed preprint metadata by DOI. Retrieves title, authors, abstract, date, version, category, license, and publication status. Returns: dict: Preprint metadata including doi, title, authors, abstract, date, version, category, license, publication status or error message. """ # Validate server if server.lower() not in ["biorxiv", "medrxiv"]: return {"error": "Server must be 'biorxiv' or 'medrxiv'"} server = server.lower() # Clean DOI - remove URL prefix if present if doi.startswith("https://doi.org/"): doi = doi.replace("https://doi.org/", "") elif doi.startswith("doi:"): doi = doi.replace("doi:", "") try: # Build URL for single DOI lookup url = f"https://api.biorxiv.org/details/{server}/{doi}/na/json" # Make request response = requests.get(url, timeout=30) response.raise_for_status() data = response.json() # Check if paper was found collection = data.get("collection", []) if not collection: return {"error": f"No preprint found with DOI {doi} on {server}", "messages": data.get("messages", [])} # Get the paper details paper = collection[0] # Return structured paper information result = { "doi": paper.get("doi", ""), "title": paper.get("title", ""), "authors": paper.get("authors", ""), "corresponding_author": paper.get("author_corresponding", ""), "corresponding_institution": paper.get("author_corresponding_institution", ""), "date": paper.get("date", ""), "version": paper.get("version", ""), "type": paper.get("type", ""), "license": paper.get("license", ""), "category": paper.get("category", ""), "abstract": paper.get("abstract", ""), "published": paper.get("published", ""), "server": paper.get("server", server), "jats_xml_path": paper.get("jats", ""), } return result except requests.exceptions.RequestException as e: logger.error(f"Error retrieving preprint {doi} from {server}: {e}") return {"error": f"Failed to retrieve preprint from {server}: {e!s}"} except Exception as e: logger.error(f"Unexpected error retrieving preprint {doi}: {e}") return {"error": f"Unexpected error: {e!s}"}
- src/biocontext_kb/core/_server.py:1-7 (registration)Defines the core_mcp FastMCP server instance named 'BC', which is used to register all core tools via @core_mcp.tool() decorators. This server is later imported into the main app with 'bc' prefix.from fastmcp import FastMCP core_mcp = FastMCP( # type: ignore "BC", instructions="Provides access to biomedical knowledge bases.", )
- src/biocontext_kb/core/biorxiv/__init__.py:1-14 (registration)Package init file that imports the get_biorxiv_preprint_details function, triggering its decorator-based registration in core_mcp when the package is imported."""bioRxiv and medRxiv preprint search tools. These tools provide access to bioRxiv and medRxiv preprint servers for searching and retrieving preprint metadata. bioRxiv focuses on biological sciences while medRxiv focuses on medical sciences. """ from ._get_preprint_details import get_biorxiv_preprint_details from ._get_recent_biorxiv_preprints import get_recent_biorxiv_preprints __all__ = [ "get_biorxiv_preprint_details", "get_recent_biorxiv_preprints", ]
- src/biocontext_kb/app.py:30-44 (registration)The setup function imports the core_mcp server (including the biorxiv tools) into the main 'BioContextAI' MCP app using import_server with slugified prefix 'bc', effectively registering all core tools with 'bc_' prefix (e.g., 'bc_get_biorxiv_preprint_details'). Also logs the tools.async def setup(mcp_app: FastMCP): """Setup function to initialize the MCP server.""" logger.info("Environment: %s", os.environ.get("MCP_ENVIRONMENT")) logger.info("Setting up MCP server...") for mcp in [core_mcp, *(await get_openapi_mcps())]: await mcp_app.import_server( mcp, slugify(mcp.name), ) logger.info("MCP server setup complete.") logger.info("Checking MCP server for valid tools...") await get_mcp_tools(mcp_app) logger.info("MCP server tools check complete.")
- src/biocontext_kb/app.py:8-9 (registration)Imports core_mcp which loads/registers all core tools (including biorxiv ones) via their decorators when modules are imported.from biocontext_kb.core import core_mcp from biocontext_kb.openapi import get_openapi_mcps