Skip to main content
Glama
biocontext-ai

BioContextAI Knowledgebase MCP

Official

bc_get_study_details

Retrieve comprehensive clinical trial details including study design, eligibility criteria, outcomes, locations, and contacts using an NCT ID.

Instructions

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nct_idYesNCT ID (e.g., 'NCT01234567')
fieldsNoComma-separated fields or 'all' for complete data. Default includes key modules.IdentificationModule,StatusModule,SponsorCollaboratorsModule,DescriptionModule,ConditionsModule,DesignModule,ArmsInterventionsModule,OutcomesModule,EligibilityModule,ContactsLocationsModule

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function implementing bc_get_study_details (prefixed from get_study_details). Fetches detailed information for a clinical trial by NCT ID from ClinicalTrials.gov API v2, with 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}"}
  • Defines the core_mcp FastMCP server instance named 'BC'. Tool functions decorated with @core_mcp.tool() are registered here. Later imported into main app with 'bc' prefix.
    from fastmcp import FastMCP
    
    core_mcp = FastMCP(  # type: ignore
        "BC",
        instructions="Provides access to biomedical knowledge bases.",
    )
  • Imports the get_study_details function, triggering its @core_mcp.tool() decorator to register the tool in core_mcp.
    from ._get_recruiting_studies_by_location import get_recruiting_studies_by_location
    from ._get_studies_by_condition import get_studies_by_condition
    from ._get_studies_by_intervention import get_studies_by_intervention
    from ._get_study_details import get_study_details
    from ._search_studies import search_studies
    
    __all__ = [
        "get_recruiting_studies_by_location",
        "get_studies_by_condition",
        "get_studies_by_intervention",
        "get_study_details",
        "search_studies",
    ]
  • Imports core_mcp into the main mcp_app, prefixing all its tools with 'bc' (slugify('BC')). This creates the 'bc_get_study_details' tool in the final server.
    for mcp in [core_mcp, *(await get_openapi_mcps())]:
        await mcp_app.import_server(
            mcp,
            slugify(mcp.name),
        )
  • Imports all clinicaltrials tools (including get_study_details) into core namespace, ensuring registration.
    from .clinicaltrials import *
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses the return type ('dict') and general content ('Study details with protocol sections'), but lacks details on error handling (only mentions 'or error message' vaguely), rate limits, authentication needs, or data freshness. It adds some behavioral context but leaves gaps for a read operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, followed by a clear returns section. Every sentence earns its place by specifying what data is retrieved and the return format, with no redundant or vague language. It is appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (implied by 'Returns: dict'), the description does not need to detail return values. It covers the purpose, data scope, and return type adequately. However, with no annotations and a read operation, it could benefit from more behavioral context (e.g., error specifics), but it is mostly complete for a lookup tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents both parameters (nct_id and fields). The description does not add any parameter-specific semantics beyond what's in the schema (e.g., no examples of field usage beyond the default). Baseline score of 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Get complete trial details') and resource ('by NCT ID'), with explicit listing of what data is retrieved ('study design, eligibility, outcomes, locations, contacts, and metadata'). It distinguishes itself from sibling tools like 'bc_search_studies' or 'bc_get_studies_by_condition' by focusing on detailed retrieval of a specific study rather than searching or filtering studies.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by specifying 'by NCT ID', suggesting this tool is for retrieving details of a known study identifier. However, it does not explicitly state when to use this versus alternatives like 'bc_search_studies' or provide exclusions (e.g., not for searching studies without an NCT ID). The context is clear but lacks explicit guidance on alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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