Skip to main content
Glama

trials_search

Search active clinical trials by condition, ICD-10 code, or intervention. Get detailed results including NCT ID, phase, enrollment, and eligibility.

Instructions

Search active clinical trials by condition, ICD-10 code, or intervention. Returns trial details including NCT ID, phase, enrollment, and eligibility. Source: ClinicalTrials.gov (public domain).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conditionNoMedical condition to search for
codeNoICD-10 code (auto-mapped to condition)
interventionNoDrug or intervention name
statusNoTrial status filter (default: RECRUITING)
limitNoMax results (default 10, max 50)

Implementation Reference

  • Tool definition and input schema for 'trials_search'. Defines name, description, price ($0.03), endpoint (/agent/v1/trials/search), and Zod schema with optional parameters: condition, code, intervention, status (enum), and limit.
    // --- Clinical Trials (ClinicalTrials.gov — free, no license) ---
    {
      name: 'trials_search',
      description: 'Search active clinical trials by condition, ICD-10 code, or intervention. Returns trial details including NCT ID, phase, enrollment, and eligibility. Source: ClinicalTrials.gov (public domain).',
      price: '$0.03',
      endpoint: '/agent/v1/trials/search',
      schema: {
        condition: z.string().optional().describe('Medical condition to search for'),
        code: z.string().optional().describe('ICD-10 code (auto-mapped to condition)'),
        intervention: z.string().optional().describe('Drug or intervention name'),
        status: z.enum(['RECRUITING', 'ACTIVE_NOT_RECRUITING', 'COMPLETED', 'NOT_YET_RECRUITING']).optional().describe('Trial status filter (default: RECRUITING)'),
        limit: z.number().optional().describe('Max results (default 10, max 50)'),
      },
    },
  • src/index.js:19-61 (registration)
    Registration of all MCP tools (including 'trials_search') via s.tool(). The generic handler makes an HTTP POST to the tool's endpoint with params and returns the JSON response. No separate handler exists; the logic is a generic fetch-based proxy.
    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 };
        }
      });
    }
  • src/index.js:66-73 (registration)
    Sandbox server registration for 'trials_search'. Returns 'sandbox' text instead of calling the real API.
    export function createSandboxServer() {
      const sandboxServer = new McpServer({ name: 'mymedi-ai', version: '1.2.1' });
      for (const tool of MCP_TOOLS) {
        sandboxServer.tool(tool.name, tool.description, tool.schema,
          async () => ({ content: [{ type: 'text', text: 'sandbox' }] }));
      }
      return sandboxServer;
    }
Behavior3/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 mentions the data source and some return fields, which is helpful, but does not explicitly state that the tool is read-only, lacks rate limit or pagination info, and does not describe error handling or data freshness. The description is adequate but leaves behavioral gaps.

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?

Two sentences, front-loaded key purpose and return fields, no extraneous text. Every word earns its place. Highly concise and structured.

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

Completeness4/5

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

Given no output schema and no annotations, the description covers the essential: search criteria, return fields (NCT ID, phase, enrollment, eligibility), and data source. It is complete enough for an AI agent to understand the tool's basic function. However, it omits details like default status filter (RECRUITING) and limit behavior, which are only in the schema.

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%, so the baseline is 3. The description adds value by explaining that 'code' is auto-mapped to condition, which is not in the schema. However, it does not further elaborate on parameter dependencies or constraints beyond what the schema already provides. Overall, the description contributes minor additional meaning.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses specific verbs and resources: 'Search active clinical trials by condition, ICD-10 code, or intervention.' It clearly identifies the tool's function and distinguishes it from siblings that handle claims, codes, drugs, etc. No other sibling tool targets clinical trials, so differentiation is inherent.

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 explicit guidance on when to use this tool versus alternatives like drug_lookup or code_lookup. It states the data source (ClinicalTrials.gov) but does not specify contexts where this tool is preferred or when other tools should be used. This lack of comparative guidance hinders tool selection.

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