Skip to main content
Glama
BACH-AI-Tools

Clinical Trials MCP Server

search_by_condition

Find clinical trials for specific medical conditions by filtering study phase and recruitment status to identify relevant research studies.

Instructions

Search for clinical trials focusing on specific medical conditions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conditionYesMedical condition, disease, or syndrome
phaseNoStudy phase filter
recruitmentStatusNoFilter by recruitment status
pageSizeNoNumber of results to return (default 10, max 100)

Implementation Reference

  • Implementation of the search_by_condition tool handler.
    async handleSearchByCondition(args) {
        if (!args?.condition) {
            throw new McpError(ErrorCode.InvalidParams, "Condition parameter is required");
        }
        const params = {
            format: "json",
            pageSize: args?.pageSize || 10,
            "query.cond": args.condition,
        };
        if (args?.phase) {
            params["filter.phase"] = args.phase;
        }
        if (args?.recruitmentStatus) {
            params["filter.overallStatus"] = args.recruitmentStatus;
        }
        try {
            const response = await this.axiosInstance.get("/studies", { params });
            const studies = response.data.studies || [];
            const results = studies.map((study) => ({
                ...this.formatStudySummary(study),
                conditions: study.protocolSection.conditionsModule?.conditions || [],
                eligibility: {
                    sex: study.protocolSection.eligibilityModule?.sex || "Unknown",
                    minimumAge: study.protocolSection.eligibilityModule?.minimumAge ||
                        "Not specified",
                    maximumAge: study.protocolSection.eligibilityModule?.maximumAge ||
                        "Not specified",
                    healthyVolunteers: study.protocolSection.eligibilityModule?.healthyVolunteers || false,
                },
            }));
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify({
                            searchCriteria: {
                                condition: args.condition,
                                phase: args.phase,
                                recruitmentStatus: args.recruitmentStatus,
                            },
                            totalCount: response.data.totalCount || 0,
                            resultsShown: results.length,
                            studies: results,
                        }, null, 2),
                    },
                ],
            };
        }
        catch (error) {
            if (axios.isAxiosError(error)) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Clinical Trials API error: ${error.response?.data?.message || error.message}`,
                        },
                    ],
                    isError: true,
                };
            }
            throw error;
        }
    }
  • build/index.js:159-192 (registration)
    Tool registration and schema definition for search_by_condition in the ListToolsRequest handler.
        name: "search_by_condition",
        description: "Search for clinical trials focusing on specific medical conditions",
        inputSchema: {
            type: "object",
            properties: {
                condition: {
                    type: "string",
                    description: "Medical condition, disease, or syndrome",
                    minLength: 2,
                },
                phase: {
                    type: "string",
                    description: "Study phase filter",
                    enum: ["PHASE1", "PHASE2", "PHASE3", "PHASE4", "NA"],
                },
                recruitmentStatus: {
                    type: "string",
                    description: "Filter by recruitment status",
                    enum: [
                        "RECRUITING",
                        "NOT_YET_RECRUITING",
                        "ACTIVE_NOT_RECRUITING",
                    ],
                },
                pageSize: {
                    type: "number",
                    description: "Number of results to return (default 10, max 100)",
                    minimum: 1,
                    maximum: 100,
                },
            },
            required: ["condition"],
        },
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool is a search operation, implying it's likely read-only and non-destructive, but doesn't confirm this or detail other behaviors like rate limits, authentication needs, pagination (beyond the 'pageSize' parameter), or error handling. For a search tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves.

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 a single, efficient sentence that front-loads the core purpose without unnecessary words. It directly states what the tool does ('Search for clinical trials') and the key filter ('focusing on specific medical conditions'), making it easy to parse quickly. Every part of the sentence earns its place.

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

Completeness3/5

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

Given the tool's moderate complexity (4 parameters, 1 required), 100% schema coverage, and no output schema, the description is minimally adequate. It clarifies the tool's focus but lacks context on behavioral traits (due to no annotations), usage guidelines, or output details. For a search tool, this leaves the agent to rely heavily on the schema, resulting in a baseline completeness score.

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%, meaning all parameters are well-documented in the input schema itself (e.g., 'condition' as 'Medical condition, disease, or syndrome'). The description adds no additional parameter semantics beyond implying a focus on 'medical conditions,' which aligns with the schema. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but doesn't need to.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Search for clinical trials focusing on specific medical conditions.' It specifies the verb ('Search') and resource ('clinical trials'), and the qualifier 'focusing on specific medical conditions' distinguishes it from general search tools. However, it doesn't explicitly differentiate from all sibling tools like 'search_by_intervention' or 'search_by_sponsor,' which also search clinical trials but with different filters.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'search_by_intervention' for drug-based searches or 'search_by_location' for geographic filters, nor does it specify prerequisites or exclusions. The agent must infer usage from the tool name and parameters alone.

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/BACH-AI-Tools/ClinicalTrials-MCP-Server'

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