search_biorxiv
Search the bioRxiv preprint server for biology papers using queries, date ranges, and category filters to find relevant research.
Instructions
Search bioRxiv preprint server for biology papers
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query string | |
| maxResults | No | Maximum number of results to return | |
| days | No | Number of days to search back (default: 30) | |
| category | No | Category filter (e.g., neuroscience, genomics) |
Implementation Reference
- src/mcp/handleToolCall.ts:153-168 (handler)Tool execution handler: dispatches to BioRxivSearcher.search(), formats results as JSON response.case 'search_biorxiv': { const { query, maxResults, days, category } = args; const results = await searchers.biorxiv.search(query, { maxResults, days, category }); return jsonTextResponse( `Found ${results.length} bioRxiv papers.\n\n${JSON.stringify( results.map((paper: Paper) => PaperFactory.toDict(paper)), null, 2 )}` ); }
- src/mcp/schemas.ts:81-88 (schema)Zod schema for validating search_biorxiv tool input parameters.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();
- src/mcp/tools.ts:162-181 (registration)MCP tool definition and registration with name, description, and JSON input schema.name: 'search_biorxiv', description: 'Search bioRxiv preprint server for biology 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., neuroscience, genomics)' } }, required: ['query'] }
- Core search logic: constructs API request to bioRxiv based on date range and category, fetches and parses papers.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'); } }
- src/mcp/searchers.ts:45-46 (helper)Instantiation of BioRxivSearcher instance assigned to searchers.biorxiv for use by tool handlers.const biorxivSearcher = new BioRxivSearcher('biorxiv'); const medrxivSearcher = new MedRxivSearcher();