Skip to main content
Glama
biocontext-ai

BioContextAI Knowledgebase MCP

Official

bc_get_study_details

Retrieve comprehensive data on clinical trials, including design, eligibility criteria, outcomes, and locations, using the NCT ID. Streamline biomedical research with verified study details.

Instructions

Get detailed information about a specific clinical trial by its NCT ID.

This function retrieves comprehensive data about a single clinical trial, including study design, eligibility criteria, outcomes, locations, and contact information.

Args: nct_id (str): NCT ID of the clinical trial (e.g., "NCT01234567"). fields (str): Comma-separated list of fields to return, or "all" for complete data. Default includes key modules for biomedical researchers.

Returns: dict: Detailed study information or error message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsNoComma-separated list of fields to return or 'all' for complete study dataIdentificationModule,StatusModule,SponsorCollaboratorsModule,DescriptionModule,ConditionsModule,DesignModule,ArmsInterventionsModule,OutcomesModule,EligibilityModule,ContactsLocationsModule
nct_idYesNCT ID of the clinical trial (e.g., 'NCT01234567')

Implementation Reference

  • The core handler function for the 'bc_get_study_details' tool (named 'get_study_details' internally, prefixed by 'BC' from FastMCP). Fetches detailed information about a clinical trial study using its NCT ID from the ClinicalTrials.gov API v2, with optional field selection. Includes input validation and error handling.
    @core_mcp.tool() def get_study_details( nct_id: Annotated[str, Field(description="NCT ID (e.g., 'NCT01234567')")], fields: Annotated[ str, Field(description="Comma-separated fields or 'all' for complete data. Default includes key modules.") ] = "IdentificationModule,StatusModule,SponsorCollaboratorsModule,DescriptionModule,ConditionsModule,DesignModule,ArmsInterventionsModule,OutcomesModule,EligibilityModule,ContactsLocationsModule", ) -> Union[Dict[str, Any], dict]: """Get complete trial details by NCT ID. Retrieves study design, eligibility, outcomes, locations, contacts, and metadata. Returns: dict: Study details with protocol sections including identification, status, sponsors, description, conditions, design, interventions, outcomes, eligibility, locations or error message. """ if not nct_id: return {"error": "NCT ID must be provided"} # Validate NCT ID format (should start with NCT followed by 8 digits) if not nct_id.upper().startswith("NCT") or len(nct_id) != 11: return {"error": "Invalid NCT ID format. Expected format: NCT12345678"} # Construct URL if fields.lower() == "all": url = f"https://clinicaltrials.gov/api/v2/studies/{nct_id}?format=json" else: url = f"https://clinicaltrials.gov/api/v2/studies/{nct_id}?fields={fields}&format=json" try: response = requests.get(url) response.raise_for_status() return response.json() except requests.exceptions.RequestException as e: if response.status_code == 404: return {"error": f"Study with NCT ID '{nct_id}' not found"} return {"error": f"Failed to fetch study details: {e!s}"}
  • Imports the get_study_details function, which triggers its registration via the @core_mcp.tool() decorator when the module is imported.
    from ._get_study_details import get_study_details
  • Imports all tools from clinicaltrials module, including get_study_details, registering them with the core_mcp FastMCP server instance (prefixed with 'BC').
    from .clinicaltrials import *

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/biocontext-ai/knowledgebase-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server