Skip to main content
Glama
BACH-AI-Tools

Clinical Trials MCP Server

search_by_primary_outcome

Find clinical trials by specifying primary outcome measures or endpoints, with optional filters for condition and study phase.

Instructions

Search clinical trials by primary outcome measures or endpoints

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
outcomeYesPrimary outcome or endpoint to search for
conditionNoOptional condition filter
phaseNoStudy phase filter
pageSizeNoNumber of results to return (default 10, max 100)

Implementation Reference

  • Handler for search_by_primary_outcome tool.
    private async handleSearchByPrimaryOutcome(args: any) {
      if (!args?.outcome) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Outcome parameter is required"
        );
      }
    
      const params: any = {
        format: "json",
        pageSize: args?.pageSize || 10,
        "query.outc": args.outcome,
      };
    
      if (args?.condition) {
        params["query.cond"] = args.condition;
      }
    
      if (args?.phase) {
        params["filter.phase"] = args.phase;
      }
    
      try {
        const response: AxiosResponse<StudySearchResponse> =
          await this.axiosInstance.get("/studies", { params });
    
        const studies = response.data.studies || [];
        const results = studies.map((study) => this.formatStudySummary(study));
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  searchCriteria: {
                    primaryOutcome: args.outcome,
                    condition: args?.condition,
                    phase: args?.phase,
                  },
                  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;
      }
    }
  • Schema definition for search_by_primary_outcome tool.
      name: "search_by_primary_outcome",
      description:
        "Search clinical trials by primary outcome measures or endpoints",
      inputSchema: {
        type: "object",
        properties: {
          outcome: {
            type: "string",
            description: "Primary outcome or endpoint to search for",
            minLength: 3,
          },
          condition: {
            type: "string",
            description: "Optional condition filter",
          },
          phase: {
            type: "string",
            description: "Study phase filter",
            enum: ["PHASE1", "PHASE2", "PHASE3", "PHASE4", "NA"],
          },
          pageSize: {
            type: "number",
            description:
              "Number of results to return (default 10, max 100)",
            minimum: 1,
            maximum: 100,
          },
        },
        required: ["outcome"],
      },
    },
  • src/index.ts:758-761 (registration)
    Registration/routing for search_by_primary_outcome tool.
    case "search_by_primary_outcome":
      return await this.handleSearchByPrimaryOutcome(
        request.params.arguments
      );
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 it's a search tool, implying read-only behavior, but doesn't mention any constraints like rate limits, authentication requirements, result format, pagination beyond the schema's 'pageSize,' or whether it's a real-time or cached search. For a search tool with zero annotation coverage, this is insufficient.

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 with zero waste. It's front-loaded with the core purpose and 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.

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, no output schema, no annotations), the description is minimally adequate. It states the purpose but lacks behavioral details and usage context. Without an output schema, it doesn't describe return values, which is a gap, but the schema coverage helps compensate.

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 documents all parameters thoroughly. The description doesn't add any meaning beyond what's in the schema (e.g., it doesn't explain what 'primary outcome measures' entail or provide examples). Baseline 3 is appropriate when the schema does the heavy lifting.

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 clinical trials by primary outcome measures or endpoints.' It specifies the verb ('search'), resource ('clinical trials'), and search criteria ('primary outcome measures or endpoints'). However, it doesn't explicitly differentiate from sibling tools like 'search_by_condition' or 'search_by_intervention,' which would require a 5.

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. With multiple sibling search tools (e.g., 'search_by_condition,' 'search_by_intervention'), there's no indication of when this specific outcome-based search is preferred or what distinguishes it from other search methods.

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