Skip to main content
Glama

health_topics

Access evidence-based health information on specific topics using the Healthcare MCP Server. Search for reliable content in English or Spanish to support informed decision-making.

Instructions

Get evidence-based health information on various topics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
languageNoLanguage for content (en or es)en
topicYesHealth topic to search for information

Implementation Reference

  • The main handler function implementing the health_topics tool logic: validates input, checks cache, queries Health.gov API, processes and cleans topic data, caches results, and formats success/error responses.
    async getHealthTopics(topic, language = 'en') {
      // Input validation
      if (!topic) {
        return this.formatErrorResponse('Topic is required');
      }
      
      // Validate language
      if (!['en', 'es'].includes(language.toLowerCase())) {
        language = 'en';
      }
      
      // Create cache key
      const cacheKey = this.getCacheKey('health_topics', topic, language);
      
      // Check cache first
      const cachedResult = this.cache.get(cacheKey);
      if (cachedResult) {
        console.error(`Cache hit for Health Topics search: ${topic}`);
        return cachedResult;
      }
      
      try {
        console.error(`Searching Health Topics for: ${topic}, language: ${language}`);
        
        // Build API URL with parameters for topicsearch
        const params = {
          keyword: topic,
          lang: language
        };
        
        const url = this.buildUrl(`${this.baseUrl}/topicsearch.json`, params);
        
        // Make the request
        const data = await this.makeRequest(url);
        
        // Process the response
        let topics = [];
        let totalResults = 0;
        
        if (data && data.Result && data.Result.Resources) {
          const rawTopics = data.Result.Resources.Resource || [];
          totalResults = rawTopics.length;
          
          // Process each topic
          for (const rawTopic of rawTopics) {
            const processedTopic = {
              title: rawTopic.Title || '',
              url: rawTopic.AccessibleVersion || rawTopic.LastUpdate || '',
              last_updated: rawTopic.LastUpdate || '',
              section: rawTopic.Sections?.Section?.[0]?.Title || '',
              description: rawTopic.Sections?.Section?.[0]?.Description || '',
              content: []
            };
            
            // Extract content from sections
            if (rawTopic.Sections && rawTopic.Sections.Section) {
              for (const section of rawTopic.Sections.Section) {
                if (section.Content) {
                  // Clean and limit content
                  let content = section.Content;
                  if (typeof content === 'string') {
                    // Remove HTML and limit size
                    content = content.replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim();
                    if (content.length > 500) {
                      content = content.substring(0, 497) + '...';
                    }
                    if (content) {
                      processedTopic.content.push(content);
                    }
                  }
                }
              }
            }
            
            topics.push(processedTopic);
          }
        }
        
        // Create result object
        const result = this.formatSuccessResponse({
          search_term: topic,
          language: language,
          total_results: totalResults,
          health_topics: topics
        });
        
        // Cache for 24 hours (86400 seconds)
        this.cache.set(cacheKey, result, 86400);
        
        return result;
        
      } catch (error) {
        console.error(`Error searching Health Topics: ${error.message}`);
        return this.formatErrorResponse(`Error searching health topics: ${error.message}`);
      }
    }
  • Input schema definition for the health_topics tool, specifying required 'topic' parameter and optional 'language' (en/es).
    inputSchema: {
      type: "object",
      properties: {
        topic: {
          type: "string",
          description: "Health topic to search for information",
        },
        language: {
          type: "string",
          description: "Language for content (en or es)",
          enum: ["en", "es"],
          default: "en",
        },
      },
      required: ["topic"],
    },
  • Tool registration in the main CallToolRequestSchema handler switch statement, dispatching calls to the HealthTopicsTool.getHealthTopics method.
    case "health_topics":
      result = await healthTopicsTool.getHealthTopics(args.topic, args.language);
  • server/index.js:31-31 (registration)
    Instantiation of the HealthTopicsTool instance used by the server.
    const healthTopicsTool = new HealthTopicsTool(cacheService);
  • Inline input validation schema enforcing required topic and valid language (en/es).
    // Input validation
    if (!topic) {
      return this.formatErrorResponse('Topic is required');
    }
    
    // Validate language
    if (!['en', 'es'].includes(language.toLowerCase())) {
      language = 'en';
    }
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 the tool 'gets' information, implying a read-only operation, but does not clarify aspects like data sources, accuracy, rate limits, or authentication needs. For a health information tool with zero annotation coverage, this is a significant gap in transparency.

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 that is front-loaded with the core purpose. It avoids redundancy and waste, making it easy to parse quickly. Every word contributes to understanding the tool's function without unnecessary elaboration.

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 lack of annotations and output schema, the description is incomplete for a health information tool. It does not address critical context like data reliability, source attribution, or response format, which are important for an agent to use the tool effectively. The description alone is insufficient for safe and informed usage.

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, fully documenting both parameters ('language' and 'topic'). The description adds no additional semantic context beyond what the schema provides, such as examples of valid topics or language implications. With high schema coverage, the baseline score of 3 is appropriate, as the description does not compensate but also does not detract.

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 as 'Get evidence-based health information on various topics,' which specifies the action (get), resource (health information), and key attributes (evidence-based, various topics). It distinguishes from siblings like 'clinical_trials_search' or 'pubmed_search' by focusing on general health topics rather than specific databases or codes, though it could be more explicit about the distinction.

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. It does not mention any context, prerequisites, or exclusions, such as when to prefer 'pubmed_search' for academic literature or 'lookup_icd_code' for medical coding. This leaves the agent without explicit usage instructions.

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/Cicatriiz/healthcare-mcp-public'

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