Skip to main content
Glama

search_medrxiv

Search the medRxiv preprint server for medical research papers using queries, date ranges, and category filters to find relevant studies.

Instructions

Search medRxiv preprint server for medical papers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query string
maxResultsNoMaximum number of results to return
daysNoNumber of days to search back (default: 30)
categoryNoCategory filter (e.g., infectious_diseases, epidemiology)

Implementation Reference

  • Main MCP tool handler for 'search_medrxiv': destructures args, calls medrxiv searcher.search(), converts results to JSON and returns formatted response.
    case 'search_medrxiv': { const { query, maxResults, days, category } = args; const results = await searchers.medrxiv.search(query, { maxResults, days, category }); return jsonTextResponse( `Found ${results.length} medRxiv papers.\n\n${JSON.stringify( results.map((paper: Paper) => PaperFactory.toDict(paper)), null, 2 )}` ); }
  • Zod schema for search_medrxiv input validation (SearchMedRxivSchema aliases SearchBioRxivSchema). Used by parseToolArgs.
    export const SearchBioRxivSchema = z .object({ query: z.string().min(1), maxResults: z.number().int().min(1).max(100).optional().default(10), days: z.number().int().min(1).max(3650).optional(), category: z.string().optional() }) .strip(); export const SearchMedRxivSchema = SearchBioRxivSchema;
  • MCP tool registration: defines name, description, and JSON inputSchema for search_medrxiv in the TOOLS export.
    { name: 'search_medrxiv', description: 'Search medRxiv preprint server for medical papers', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query string' }, maxResults: { type: 'number', minimum: 1, maximum: 100, description: 'Maximum number of results to return' }, days: { type: 'number', description: 'Number of days to search back (default: 30)' }, category: { type: 'string', description: 'Category filter (e.g., infectious_diseases, epidemiology)' } }, required: ['query'] } },
  • Core search logic in MedRxivSearcher (extends BioRxivSearcher): constructs API URL with date range, fetches from medRxiv API, parses response into Paper objects.
    async search(query: string, options: BioRxivSearchOptions = {}): Promise<Paper[]> { try { // 计算日期范围 const days = options.days || 30; const endDate = new Date().toISOString().split('T')[0]; const startDate = new Date(Date.now() - days * 24 * 60 * 60 * 1000).toISOString().split('T')[0]; // 构建搜索URL const searchUrl = `${this.baseUrl}/${startDate}/${endDate}`; const params: Record<string, any> = { cursor: 0 }; // 添加分类过滤 if (query && query !== '*') { // 将查询转换为分类格式 const category = query.toLowerCase().replace(/\s+/g, '_'); params.category = category; } logDebug(`${this.serverType} API Request: GET ${searchUrl}`); logDebug(`${this.serverType} Request params:`, params); const response = await axios.get(searchUrl, { params, timeout: TIMEOUTS.DEFAULT, headers: { 'User-Agent': USER_AGENT } }); logDebug(`${this.serverType} API Response: ${response.status} ${response.statusText}`); const papers = this.parseSearchResponse(response.data, query, options); logDebug(`${this.serverType} Parsed ${papers.length} papers`); return papers.slice(0, options.maxResults || 10); } catch (error: any) { logDebug(`${this.serverType} Search Error:`, error.message); this.handleHttpError(error, 'search'); } }
  • MedRxivSearcher class definition, extends BioRxivSearcher with server='medrxiv' for medRxiv-specific searching.
    export class MedRxivSearcher extends BioRxivSearcher { constructor() { super('medrxiv'); } }
  • Instantiation of MedRxivSearcher instance assigned to searchers.medrxiv.
    const biorxivSearcher = new BioRxivSearcher('biorxiv'); const medrxivSearcher = new MedRxivSearcher();

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/Dianel555/paper-search-mcp-nodejs'

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