get_trending_articles
Retrieve recently published or trending articles in a specific biomedical field. Set the lookback period and maximum results as needed.
Instructions
Get recently published or trending articles in a specific field
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| field | Yes | Research field or topic | |
| days | No | Number of days to look back (default: 30) | |
| max_results | No | Maximum results (default: 20) |
Implementation Reference
- src/index.ts:710-741 (handler)The handler function that executes the 'get_trending_articles' tool logic. It accepts 'field', 'days', and 'max_results' parameters, searches PubMed via eutilsClient with a date range, and returns matching article PMIDs.
async function handleGetTrendingArticles(args: any) { const { field, days = 30, max_results = 20 } = args; const endDate = new Date(); const startDate = new Date(); startDate.setDate(startDate.getDate() - days); const searchResult = await eutilsClient.search({ term: field, retmax: max_results, mindate: formatDateForAPI(startDate), maxdate: formatDateForAPI(endDate), sort: 'pub+date' }); return { content: [ { type: 'text', text: JSON.stringify({ field, days, dateRange: { from: formatDateForAPI(startDate), to: formatDateForAPI(endDate) }, totalResults: searchResult.count, pmids: searchResult.pmids }, null, 2) } ] }; - src/index.ts:226-251 (registration)Where the 'get_trending_articles' tool is registered with its name, description, and input schema. It defines required 'field' param and optional 'days' and 'max_results' params.
{ name: 'get_trending_articles', description: 'Get recently published or trending articles in a specific field', inputSchema: { type: 'object', properties: { field: { type: 'string', description: 'Research field or topic' }, days: { type: 'number', description: 'Number of days to look back (default: 30)', minimum: 1, maximum: 365 }, max_results: { type: 'number', description: 'Maximum results (default: 20)', minimum: 1, maximum: 100 } }, required: ['field'] } }, - src/index.ts:229-250 (schema)The inputSchema for 'get_trending_articles' defines validation for field (required string), days (optional number 1-365), and max_results (optional number 1-100).
inputSchema: { type: 'object', properties: { field: { type: 'string', description: 'Research field or topic' }, days: { type: 'number', description: 'Number of days to look back (default: 30)', minimum: 1, maximum: 365 }, max_results: { type: 'number', description: 'Maximum results (default: 20)', minimum: 1, maximum: 100 } }, required: ['field'] }