drug_interactions
Check drug-drug interaction signals from FDA adverse event co-reports. Returns co-reported reactions and signal strength.
Instructions
Check drug-drug interaction signals from FDA adverse event co-reports. Returns co-reported reactions and signal strength. Source: OpenFDA FAERS (public domain).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| drugs | Yes | Array of 2-5 drug names to check for interactions |
Implementation Reference
- src/tools.js:129-132 (schema)Input schema for drug_interactions tool: accepts an array of 2-5 drug names to check for interactions.
schema: { drugs: z.array(z.string()).min(2).max(5).describe('Array of 2-5 drug names to check for interactions'), }, }, - src/tools.js:124-132 (registration)Registration of the drug_interactions tool as part of the MCP_TOOLS array. It has name, description, price, endpoint, and Zod schema.
{ name: 'drug_interactions', description: 'Check drug-drug interaction signals from FDA adverse event co-reports. Returns co-reported reactions and signal strength. Source: OpenFDA FAERS (public domain).', price: '$0.03', endpoint: '/agent/v1/drugs/interactions', schema: { drugs: z.array(z.string()).min(2).max(5).describe('Array of 2-5 drug names to check for interactions'), }, }, - src/index.js:19-61 (handler)Generic handler that forwards the drug_interactions request to the remote API endpoint /agent/v1/drugs/interactions via fetch, passing the params as JSON body. All tools use this same generic handler.
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 }; } }); }