Skip to main content
Glama
BACH-AI-Tools

Clinical Trials MCP Server

get_studies_with_results

Find completed clinical trials with published results by filtering for medical conditions, interventions, and completion dates to access study outcomes.

Instructions

Find completed clinical trials that have published results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conditionNoMedical condition to filter by
interventionNoTreatment or intervention to filter by
completedAfterNoFind studies completed after this date (YYYY-MM-DD)
pageSizeNoNumber of results to return (default 10, max 100)

Implementation Reference

  • Handler function for the 'get_studies_with_results' tool, which fetches completed trials with results from the ClinicalTrials.gov API.
    private async handleGetStudiesWithResults(args: any) {
      const params: any = {
        format: "json",
        pageSize: args?.pageSize || 10,
        "filter.overallStatus": "COMPLETED",
        "filter.hasResults": true,
      };
    
      if (args?.condition) {
        params["query.cond"] = args.condition;
      }
    
      if (args?.intervention) {
        params["query.intr"] = args.intervention;
      }
    
      if (args?.completedAfter) {
        params["filter.primaryCompletionDateFrom"] = args.completedAfter;
      }
    
      try {
        const response: AxiosResponse<StudySearchResponse> =
          await this.axiosInstance.get("/studies", { params });
    
        const studies = response.data.studies || [];
        const results = studies.map((study) => ({
          ...this.formatStudySummary(study),
          completionDate:
            study.protocolSection.statusModule.primaryCompletionDateStruct?.date,
          hasResults: true,
        }));
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  searchCriteria: {
                    status: "COMPLETED",
                    hasResults: true,
                    condition: args?.condition,
                    intervention: args?.intervention,
                    completedAfter: args?.completedAfter,
                  },
                  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;
      }
    }
  • src/index.ts:438-467 (registration)
    Tool definition for 'get_studies_with_results' in the list of available tools.
      name: "get_studies_with_results",
      description:
        "Find completed clinical trials that have published results",
      inputSchema: {
        type: "object",
        properties: {
          condition: {
            type: "string",
            description: "Medical condition to filter by",
          },
          intervention: {
            type: "string",
            description: "Treatment or intervention to filter by",
          },
          completedAfter: {
            type: "string",
            description:
              "Find studies completed after this date (YYYY-MM-DD)",
            pattern: "^\\d{4}-\\d{2}-\\d{2}$",
          },
          pageSize: {
            type: "number",
            description:
              "Number of results to return (default 10, max 100)",
            minimum: 1,
            maximum: 100,
          },
        },
      },
    },

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