Skip to main content
Glama
Kartha-AI

MCP Server for Google Cloud Healthcare API

by Kartha-AI

search-pubmed

Search PubMed to retrieve medical literature based on specific queries, supporting healthcare workflows and clinical decision-making within MCP Server for Google Cloud Healthcare API.

Instructions

Search PubMed for medical literature

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxResultsNo
queryYes

Implementation Reference

  • Main handler function for executing the 'search-pubmed' tool. Parses arguments, uses caching, calls searchArticles, and formats response as MCP content.
    async getArticles(args: any, cache: CacheManager) {
      const { query, maxResults } = args;
      const cacheKey = cache.createKey('pubmed', { query, maxResults });
      
      const articles = await cache.getOrFetch(
        cacheKey,
        () => this.searchArticles(query, maxResults)
      );
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(articles, null, 2)
        }]
      };
    }
  • Helper function that performs the actual PubMed search using EUtils esearch.fcgi for IDs and esummary.fcgi for details, then maps to PubMedArticle format.
    async searchArticles(query: string, maxResults: number = 10): Promise<PubMedArticle[]> {
      // Search for article IDs
      const searchUrl = new URL(`${this.baseUrl}/esearch.fcgi`);
      searchUrl.searchParams.append('db', 'pubmed');
      searchUrl.searchParams.append('term', query);
      searchUrl.searchParams.append('retmax', maxResults.toString());
      searchUrl.searchParams.append('retmode', 'json');
      searchUrl.searchParams.append('api_key', this.apiKey);
    
      const searchResponse = await fetch(searchUrl);
      const searchData = await searchResponse.json() as PubMedSearchResponse;
      const pmids = searchData.esearchresult.idlist;
    
      if (!pmids.length) {
        return [];
      }
    
      // Get article details
      const summaryUrl = new URL(`${this.baseUrl}/esummary.fcgi`);
      summaryUrl.searchParams.append('db', 'pubmed');
      summaryUrl.searchParams.append('id', pmids.join(','));
      summaryUrl.searchParams.append('retmode', 'json');
      summaryUrl.searchParams.append('api_key', this.apiKey);
    
      const summaryResponse = await fetch(summaryUrl);
      const summaryData = await summaryResponse.json() as PubMedSummaryResponse;
    
      return pmids.map((pmid: string) => {
        const article = summaryData.result[pmid];
        return {
          title: article.title,
          authors: article.authors.map((a: any) => a.name),
          journal: article.fulljournalname,
          pubDate: article.pubdate,
          doi: article.elocationid,
          abstract: article.abstract,
          pmid: pmid
        };
      });
    }
  • Tool definition including name, description, and input schema for 'search-pubmed'.
    {
      name: 'search-pubmed',
      description: 'Search PubMed for medical literature',
      inputSchema: {
        type: 'object',
        properties: {
          query: { type: 'string' },
          maxResults: { type: 'number' }
        },
        required: ['query']
      }
    },
  • The handleList function that returns all tool definitions, including search-pubmed, to the MCP server.
    private handleList = async () => ({
      tools: TOOL_DEFINITIONS
    });
  • Switch case in handleCall that routes 'search-pubmed' tool calls to the PubMed API handler.
    case "search-pubmed":
      return await this.pubmedApi.getArticles(request.params.arguments,this.cache);
Behavior1/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but offers none. It doesn't indicate whether this is a read-only operation, what authentication might be required, rate limits, pagination behavior, or what format results return. The description is purely functional with no behavioral context.

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 extremely concise at just 5 words, with zero wasted language. It's front-loaded with the core purpose and contains no unnecessary elaboration. Every word earns its place in communicating the basic function.

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

Completeness1/5

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

For a search tool with 2 parameters (one required), no annotations, no output schema, and 0% schema description coverage, the description is completely inadequate. It provides only the most basic functional statement without any context about how to use it effectively, what to expect in return, or behavioral considerations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage for both parameters, the description provides no information about what 'query' should contain (search terms, filters, syntax) or what 'maxResults' represents (default value, range constraints, pagination). The description doesn't compensate for the complete lack of parameter documentation in the schema.

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') and resource ('PubMed for medical literature'), providing a specific verb+resource combination. It distinguishes from most sibling tools which focus on patient data retrieval, though it doesn't explicitly differentiate from 'search-trials' which is another search tool.

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. There's no mention of when to choose this over 'search-trials' or other information retrieval tools, nor any context about appropriate use cases or prerequisites.

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

Related 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/Kartha-AI/google-cloud-healthcare-api-mcp'

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