Skip to main content
Glama

drug_enrich

Enrich drug information by querying OpenFDA to obtain drug details, indications, interactions, and AI-powered analysis for any brand or generic drug.

Instructions

Drug information enrichment via OpenFDA. Returns drug details, indications, interactions, and AI analysis.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
drugNameYesDrug name (brand or generic, min 2 chars)
searchFieldNoSearch by brand or generic name

Implementation Reference

  • src/tools.js:233-242 (registration)
    Tool registration for 'drug_enrich' in MCP_TOOLS array. Defines name, description, price ($0.03), endpoint (/agent/v1/drugs/enrich), and Zod schema (drugName required, searchField optional enum of brand_name/generic_name).
    {
      name: 'drug_enrich',
      description: 'Drug information enrichment via OpenFDA. Returns drug details, indications, interactions, and AI analysis.',
      price: '$0.03',
      endpoint: '/agent/v1/drugs/enrich',
      schema: {
        drugName: z.string().describe('Drug name (brand or generic, min 2 chars)'),
        searchField: z.enum(['brand_name', 'generic_name']).optional().describe('Search by brand or generic name'),
      },
    },
  • Generic MCP tool handler in createMcpServer() that iterates over MCP_TOOLS including drug_enrich. Each tool's handler makes an HTTP POST to the configured API base URL with the tool's endpoint and user's params, returning JSON responses or error/payment info.
    for (const tool of MCP_TOOLS) {
      s.tool(tool.name, tool.description, tool.schema, async (params) => {
        const toolDef = getToolByName(tool.name);
        if (!toolDef) {
          return { content: [{ type: 'text', text: `Unknown tool: ${tool.name}` }], isError: true };
        }
        try {
          const response = await fetch(`${API_BASE_URL}${toolDef.endpoint}`, {
            method: 'POST',
            headers: {
              'Content-Type': 'application/json',
              ...(API_KEY && { 'X-API-Key': API_KEY }),
              'X-Agent-ID': 'mcp-client',
              'User-Agent': '@mymedi-ai/mcp-server/1.2.1',
            },
            body: JSON.stringify(params),
          });
          if (response.status === 402) {
            const paymentInfo = await response.json();
            return {
              content: [{ type: 'text', text: JSON.stringify({
                error: 'payment_required',
                message: `This tool costs ${toolDef.price} per call. Register at ${API_BASE_URL}/bot-marketplace/register for an API key with 10 free starter credits, or pay per call with on-chain USDC (no signup) via the x402 protocol.`,
                price: toolDef.price, register: `${API_BASE_URL}/bot-marketplace/register`, ...paymentInfo,
              }, null, 2) }], isError: true,
            };
          }
          if (!response.ok) {
            const error = await response.json().catch(() => ({ message: response.statusText }));
            return { content: [{ type: 'text', text: JSON.stringify({ error: true, status: response.status, ...error }, null, 2) }], isError: true };
          }
          const data = await response.json();
          const creditsSpent = response.headers.get('X-Credits-Spent');
          const creditsRemaining = response.headers.get('X-Credits-Remaining');
          if (creditsSpent) {
            data._billing = { creditsSpent: parseInt(creditsSpent, 10), creditsRemaining: creditsRemaining ? parseInt(creditsRemaining, 10) : undefined, priceUSD: toolDef.price };
          }
          return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
        } catch (err) {
          return { content: [{ type: 'text', text: JSON.stringify({ error: true, message: err.message, hint: 'Ensure MCP_API_BASE_URL and MCP_API_KEY environment variables are set.' }, null, 2) }], isError: true };
        }
      });
    }
    return s;
Behavior2/5

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

No annotations provided. The description mentions data source (OpenFDA) and output types but lacks details on authentication, rate limits, or behavioral side effects. The tool likely performs multiple API calls, but this is not disclosed.

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?

Single sentence that front-loads the purpose ('drug information enrichment via OpenFDA') and lists outputs. Efficient and to the point, though a more structured format could improve readability.

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?

No output schema is provided, yet the description only lists categories (details, indications, interactions, AI analysis) without describing structure or format. For a tool that returns complex data, more detail on the response is needed.

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?

Schema coverage is 100% with clear parameter descriptions. The description does not add extra meaning beyond the schema's explanation of drugName and searchField, but this is adequate since the schema is self-contained.

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 enriches drug information via OpenFDA and lists outputs (details, indications, interactions, AI analysis). It differentiates from siblings like drug_lookup or drug_interactions by combining multiple aspects. However, the verb 'enrich' is slightly vague without further context.

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 vs. alternatives like drug_lookup or drug_interactions. The description implies comprehensiveness but does not state scenarios where enrichment is preferred over basic lookup.

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/MyMedi-AI/mymedi-ai-mcp-server'

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