Skip to main content
Glama
BACH-AI-Tools

Clinical Trials MCP Server

search_by_sponsor

Find clinical trials by sponsor or organization to identify research studies funded by specific companies, institutions, or government agencies.

Instructions

Search clinical trials by sponsor or organization

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sponsorYesSponsor name or organization (e.g., "Pfizer", "National Cancer Institute")
sponsorTypeNoType of sponsor
pageSizeNoNumber of results to return (default 10, max 100)

Implementation Reference

  • The `handleSearchBySponsor` method implements the logic for the `search_by_sponsor` tool. It takes `sponsor` and `sponsorType` as arguments and queries the ClinicalTrials.gov API.
    private async handleSearchBySponsor(args: any) {
      if (!args?.sponsor) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Sponsor parameter is required"
        );
      }
    
      const params: any = {
        format: "json",
        pageSize: args?.pageSize || 10,
        "query.spons": args.sponsor,
      };
    
      if (args?.sponsorType) {
        params["filter.leadSponsorClass"] = args.sponsorType;
      }
    
      try {
        const response: AxiosResponse<StudySearchResponse> =
          await this.axiosInstance.get("/studies", { params });
    
        const studies = response.data.studies || [];
        const results = studies.map((study) => ({
          ...this.formatStudySummary(study),
          sponsorDetails:
            study.protocolSection.sponsorCollaboratorsModule?.leadSponsor,
        }));
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  searchCriteria: {
                    sponsor: args.sponsor,
                    sponsorType: args.sponsorType,
                  },
                  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:300-326 (registration)
    The tool `search_by_sponsor` is registered within the `ListToolsRequestSchema` handler in `src/index.ts`. It takes a `sponsor` string and optional `sponsorType` and `pageSize` arguments.
      name: "search_by_sponsor",
      description: "Search clinical trials by sponsor or organization",
      inputSchema: {
        type: "object",
        properties: {
          sponsor: {
            type: "string",
            description:
              'Sponsor name or organization (e.g., "Pfizer", "National Cancer Institute")',
            minLength: 2,
          },
          sponsorType: {
            type: "string",
            description: "Type of sponsor",
            enum: ["INDUSTRY", "NIH", "FED", "OTHER"],
          },
          pageSize: {
            type: "number",
            description:
              "Number of results to return (default 10, max 100)",
            minimum: 1,
            maximum: 100,
          },
        },
        required: ["sponsor"],
      },
    },

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