search_by_author
Retrieve biomedical articles by author name, optionally filtering by affiliation, with configurable result limits.
Instructions
Find articles by specific author(s)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| author_name | Yes | Author name (e.g., "Smith J", "John Smith") | |
| affiliation | No | Author affiliation/institution (optional) | |
| max_results | No | Maximum results (default: 50) |
Implementation Reference
- src/index.ts:617-645 (handler)The handler function `handleSearchByAuthor` that executes the tool logic. It accepts `author_name`, optional `affiliation`, and `max_results`, builds a query using `buildFieldQuery`, calls `eutilsClient.search()`, and returns results as JSON text content.
async function handleSearchByAuthor(args: any) { const { author_name, affiliation, max_results = 50 } = args; let query = buildFieldQuery(author_name, 'Author'); if (affiliation) { query += ' AND ' + buildFieldQuery(affiliation, 'Affiliation'); } const searchResult = await eutilsClient.search({ term: query, retmax: max_results, sort: 'pub+date' }); return { content: [ { type: 'text', text: JSON.stringify({ author: author_name, affiliation, totalResults: searchResult.count, pmids: searchResult.pmids }, null, 2) } ] }; } - src/index.ts:146-167 (schema)Input schema definition for 'search_by_author' tool. Defines `author_name` (required string), `affiliation` (optional string), and `max_results` (optional number, default 50) with constraints.
name: 'search_by_author', description: 'Find articles by specific author(s)', inputSchema: { type: 'object', properties: { author_name: { type: 'string', description: 'Author name (e.g., "Smith J", "John Smith")' }, affiliation: { type: 'string', description: 'Author affiliation/institution (optional)' }, max_results: { type: 'number', description: 'Maximum results (default: 50)', minimum: 1, maximum: 1000 } }, required: ['author_name'] } - src/index.ts:446-447 (registration)Registration/case branch inside the `CallToolRequestSchema` handler that routes 'search_by_author' to `handleSearchByAuthor`.
case 'search_by_author': return await handleSearchByAuthor(args); - src/api/utils.ts:251-254 (helper)Helper function `buildFieldQuery` used by the handler to format query terms with field qualifiers (e.g., 'Smith[Author]'). Delegates to `sanitizeSearchTerm`.
export function buildFieldQuery(term: string, field: string): string { const sanitized = sanitizeSearchTerm(term); return `${sanitized}[${field}]`; }