bc_get_europepmc_fulltext
Retrieve full text XML content from Europe PMC using a PMC ID. This tool enables access to biomedical literature for AI systems, facilitating research and knowledge extraction.
Instructions
Get the full text XML for a given PMC ID from Europe PMC.
Args: pmc_id (str): PMC ID starting with "PMC" (e.g., "PMC11629965").
Returns: dict: Full text XML content or error message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pmc_id | Yes | PMC ID starting with 'PMC' (e.g., 'PMC11629965') |
Implementation Reference
- The core handler function for the tool, decorated with @core_mcp.tool(). Due to the 'BC' prefix on core_mcp, the tool is named 'bc_get_europepmc_fulltext'. Includes inline schema via Pydantic Annotated Field.@core_mcp.tool() def get_europepmc_fulltext( pmc_id: Annotated[str, Field(description="PMC ID (e.g., 'PMC11629965')")], ) -> dict: """Get full-text XML for a PMC ID. Returns the complete article XML for processing and analysis. Returns: dict: Full-text XML content in format {'fulltext_xml': '...'} or error message. """ # Validate PMC ID format pmc_id = pmc_id.strip().upper() if not pmc_id or not pmc_id.startswith("PMC"): return {"error": "PMC ID must start with 'PMC'"} url = f"https://www.ebi.ac.uk/europepmc/webservices/rest/{pmc_id}/fullTextXML" try: response = requests.get(url) response.raise_for_status() # Return the XML content as a string return {"fulltext_xml": response.text} except requests.exceptions.RequestException as e: return {"error": f"Failed to fetch full text XML: {e!s}"}
- src/biocontext_kb/core/_server.py:3-6 (registration)Defines the core_mcp FastMCP instance with name 'BC', which prefixes all decorated tools with 'bc_'.core_mcp = FastMCP( # type: ignore "BC", instructions="Provides access to biomedical knowledge bases.", )
- src/biocontext_kb/app.py:35-39 (registration)Registers the core_mcp (containing the tool) into the main mcp_app server under the slugified name 'bc'.for mcp in [core_mcp, *(await get_openapi_mcps())]: await mcp_app.import_server( mcp, slugify(mcp.name), )
- Re-exports the get_europepmc_fulltext function for easy import.from ._get_europepmc_fulltext import get_europepmc_fulltext __all__ = ["get_europepmc_articles", "get_europepmc_fulltext"]