search-trials
Search ClinicalTrials.gov for studies matching specified medical conditions and locations. Helps users identify relevant clinical trials efficiently.
Instructions
Search ClinicalTrials.gov for relevant studies
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"condition": "<condition>"
},
"name": "search-trials"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| condition | Yes | ||
| location | No |
Implementation Reference
- Core implementation of the 'search-trials' tool: extracts parameters, applies caching, queries ClinicalTrials.gov API via searchTrials, and returns formatted JSON results.
async getTrials(args: any, cache: CacheManager) { const { condition, location } = args; const cacheKey = cache.createKey('trials', { condition, location }); const trials = await cache.getOrFetch( cacheKey, () => this.searchTrials(condition, location) ); return { content: [{ type: 'text', text: JSON.stringify(trials, null, 2) }] }; } - Defines the tool metadata and input schema validation for 'search-trials'.
name: 'search-trials', description: 'Search ClinicalTrials.gov for relevant studies', inputSchema: { type: 'object', properties: { condition: { type: 'string' }, location: { type: 'string' } }, required: ['condition'] } }, - src/server/handlers/ToolHandler.ts:32-39 (registration)Registers MCP handlers for listTools (returns tool definitions including search-trials) and callTool requests.
register(mcpServer: Server) { mcpServer.setRequestHandler(ListToolsRequestSchema, this.handleList); mcpServer.setRequestHandler(CallToolRequestSchema, this.handleCall); } private handleList = async () => ({ tools: TOOL_DEFINITIONS }); - src/server/handlers/ToolHandler.ts:94-95 (handler)Dispatcher in callTool handler that routes 'search-trials' invocations to the ClinicalTrials API implementation.
case "search-trials": return await this.trialsApi.getTrials(request.params.arguments,this.cache);