bc_get_europepmc_fulltext
Retrieve complete article XML from EuropePMC using PMC ID for biomedical text processing and analysis.
Instructions
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.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pmc_id | Yes | PMC ID (e.g., 'PMC11629965') |
Implementation Reference
- The main handler function for the get_europepmc_fulltext tool (likely the intended bc_get_europepmc_fulltext), decorated with @core_mcp.tool(). It fetches the full-text XML from Europe PMC using the provided PMC ID, validates the ID, handles requests, and returns the XML or error.@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}"}
- Pydantic schema definition for the tool input: pmc_id parameter with description and validation.pmc_id: Annotated[str, Field(description="PMC ID (e.g., 'PMC11629965')")],
- Registration of the tool via the @core_mcp.tool() decorator on the handler function.@core_mcp.tool()
- src/biocontext_kb/core/europepmc/__init__.py:6-6 (registration)Exports the tool function in the module __init__.py for import.__all__ = ["get_europepmc_articles", "get_europepmc_fulltext"]
- The FastMCP server instance named 'BC' that collects and serves all @tool decorated functions, including this one.core_mcp = FastMCP( # type: ignore "BC", instructions="Provides access to biomedical knowledge bases.", )