Skip to main content
Glama

search-medical-databases

Search across PubMed, Google Scholar, Cochrane, and ClinicalTrials.gov to find comprehensive medical research and clinical trial information for any medical topic or condition.

Instructions

Search across multiple medical databases (PubMed, Google Scholar, Cochrane, ClinicalTrials.gov) for comprehensive results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesMedical topic or condition to search for across multiple databases

Implementation Reference

  • Core implementation of the tool handler: performs parallel searches across PubMed, Google Scholar, Cochrane Library, and ClinicalTrials.gov, processes results, removes duplicates, and limits to 20 results.
    export async function searchMedicalDatabases(
      query: string,
    ): Promise<GoogleScholarArticle[]> {
      console.log(`šŸ” Searching medical databases for: ${query}`);
    
      // Try multiple medical databases in parallel
      const searches = await Promise.allSettled([
        searchPubMedArticles(query, 5),
        searchGoogleScholar(query),
        searchCochraneLibrary(query),
        searchClinicalTrials(query),
      ]);
    
      const results: GoogleScholarArticle[] = [];
    
      // Process PubMed results
      if (searches[0].status === "fulfilled" && searches[0].value) {
        searches[0].value.forEach((article) => {
          results.push({
            title: article.title,
            authors: article.authors.join(", "),
            abstract: article.abstract,
            journal: article.journal,
            year: article.publication_date.split("-")[0],
            citations: "",
            url: `https://pubmed.ncbi.nlm.nih.gov/${article.pmid}/`,
          });
        });
      }
    
      // Process Google Scholar results
      if (searches[1].status === "fulfilled" && searches[1].value) {
        results.push(...searches[1].value);
      }
    
      // Process Cochrane Library results
      if (searches[2].status === "fulfilled" && searches[2].value) {
        results.push(...searches[2].value);
      }
    
      // Process Clinical Trials results
      if (searches[3].status === "fulfilled" && searches[3].value) {
        results.push(...searches[3].value);
      }
    
      // Remove duplicates based on title similarity
      const uniqueResults = results.filter(
        (article, index, self) =>
          index ===
          self.findIndex(
            (a) =>
              a.title.toLowerCase().replace(/[^\w\s]/g, "") ===
              article.title.toLowerCase().replace(/[^\w\s]/g, ""),
          ),
      );
    
      return uniqueResults.slice(0, 20); // Limit to 20 results
    }
  • src/index.ts:233-251 (registration)
    Registration of the 'search-medical-databases' tool with MCP server, including description, Zod input schema, and wrapper handler that calls the core implementation.
    server.tool(
      "search-medical-databases",
      "Search across multiple medical databases (PubMed, Google Scholar, Cochrane, ClinicalTrials.gov) for comprehensive results",
      {
        query: z
          .string()
          .describe(
            "Medical topic or condition to search for across multiple databases",
          ),
      },
      async ({ query }) => {
        try {
          const articles = await searchMedicalDatabases(query);
          return formatMedicalDatabasesSearch(articles, query);
        } catch (error: any) {
          return createErrorResponse("searching medical databases", error);
        }
      },
    );
  • Zod input schema for the tool: single string parameter 'query'.
      query: z
        .string()
        .describe(
          "Medical topic or condition to search for across multiple databases",
        ),
    },
  • Helper function to format and enrich the search results with safety warnings and source information before returning as MCP response.
    export function formatMedicalDatabasesSearch(articles: any[], query: string) {
      if (articles.length === 0) {
        return createMCPResponse(
          `No medical articles found for "${query}" across any databases. This could be due to no results matching your query, database API rate limiting, or network connectivity issues.`,
        );
      }
    
      let result = `**Comprehensive Medical Database Search: "${query}"**\n\n`;
      result += `Found ${articles.length} article(s) across multiple databases\n\n`;
    
      articles.forEach((article, index) => {
        result += formatArticleItem(article, index);
      });
    
      result += `\n🚨 **CRITICAL SAFETY WARNING:**\n`;
      result += `This comprehensive search retrieves information from multiple medical databases dynamically.\n\n`;
      result += `**DYNAMIC DATA SOURCES:**\n`;
      result += `• PubMed (National Library of Medicine)\n`;
      result += `• Google Scholar (Academic search)\n`;
      result += `• Cochrane Library (Systematic reviews)\n`;
      result += `• ClinicalTrials.gov (Clinical trials)\n`;
      result = addDataNote(result);
    
      return createMCPResponse(result);
    }
  • Type definition used for the unified article format returned by the handler and helpers.
    export type GoogleScholarArticle = {
      title: string;
      authors?: string;
      abstract?: string;
      journal?: string;
      year?: string;
      citations?: string;
      url?: string;
      pdf_url?: string;
      related_articles?: string[];
    };
    
    export type ClinicalGuideline = {
      title: string;
      organization: string;
      year: string;
      url: string;
      description?: string;
      category?: string;
      evidence_level?: string;
    };
    
    export type DrugInteraction = {
      drug1: string;
      drug2: string;
      severity: "Minor" | "Moderate" | "Major" | "Contraindicated";
      description: string;
      clinical_effects: string;
      management: string;
      evidence_level: string;
    };
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool searches across multiple databases for comprehensive results but lacks details on rate limits, authentication needs, result format, pagination, or error handling. This is a significant gap for a search tool with no structured safety hints.

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

Conciseness4/5

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

The description is a single, efficient sentence that front-loads the key action and resources. It avoids unnecessary words, though it could be slightly more structured by explicitly listing use cases or limitations.

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

Completeness2/5

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

Given the complexity of searching multiple medical databases, no annotations, and no output schema, the description is incomplete. It doesn't explain result types, handling of multiple sources, or potential constraints, making it inadequate for informed tool selection by an AI agent.

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?

The input schema has 100% description coverage, with the 'query' parameter documented as 'Medical topic or condition to search for across multiple databases'. The description adds no additional parameter details beyond this, so it meets the baseline of 3 where 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 action ('Search across multiple medical databases') and the resource ('medical databases'), specifying PubMed, Google Scholar, Cochrane, and ClinicalTrials.gov. It distinguishes from some siblings like 'search-google-scholar' (single database) but not all, such as 'search-medical-literature' which might overlap.

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?

No explicit guidance on when to use this tool versus alternatives is provided. It mentions 'comprehensive results' but doesn't clarify when to choose this over siblings like 'search-medical-journals' or 'search-medical-literature', leaving usage context implied rather than stated.

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/JamesANZ/medical-mcp'

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