search_crossref
Search academic papers from Crossref database to find scholarly publications with metadata filters for authors, years, and citations.
Instructions
Search academic papers from Crossref database. Free API with extensive scholarly metadata coverage across publishers.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query string | |
| maxResults | No | Maximum number of results to return | |
| year | No | Year filter (e.g., "2023", "2020-2023") | |
| author | No | Author name filter | |
| sortBy | No | Sort results by relevance, date, or citations | |
| sortOrder | No | Sort order: ascending or descending |
Implementation Reference
- src/mcp/handleToolCall.ts:408-425 (handler)Executes the search_crossref tool by calling the Crossref searcher's search method with parsed arguments and returns formatted JSON results.case 'search_crossref': { const { query, maxResults, year, author, sortBy, sortOrder } = args; const results = await searchers.crossref.search(query, { maxResults, year, author, sortBy, sortOrder }); return jsonTextResponse( `Found ${results.length} Crossref papers.\n\n${JSON.stringify( results.map((paper: Paper) => PaperFactory.toDict(paper)), null, 2 )}` ); }
- src/mcp/schemas.ts:192-201 (schema)Zod schema definition for validating search_crossref tool input arguments.export const SearchCrossrefSchema = z .object({ query: z.string().min(1), maxResults: z.number().int().min(1).max(100).optional().default(10), year: z.string().optional(), author: z.string().optional(), sortBy: SortBySchema.optional().default('relevance'), sortOrder: SortOrderSchema.optional().default('desc') }) .strip();
- src/mcp/tools.ts:465-493 (registration)MCP tool registration entry defining name, description, and JSON input schema for search_crossref.name: 'search_crossref', description: 'Search academic papers from Crossref database. Free API with extensive scholarly metadata coverage across publishers.', 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' }, year: { type: 'string', description: 'Year filter (e.g., "2023", "2020-2023")' }, author: { type: 'string', description: 'Author name filter' }, sortBy: { type: 'string', enum: ['relevance', 'date', 'citations'], description: 'Sort results by relevance, date, or citations' }, sortOrder: { type: 'string', enum: ['asc', 'desc'], description: 'Sort order: ascending or descending' } }, required: ['query'] } }
- Implements the core search logic for Crossref API, including query construction, filtering, sorting, API call, and response parsing.async search(query: string, options: SearchOptions = {}): Promise<Paper[]> { const maxResults = Math.min(options.maxResults || 10, 1000); const params: Record<string, any> = { query: query, rows: maxResults, mailto: this.mailto }; // Build filters const filters: string[] = []; // Year filter if (options.year) { const yearMatch = options.year.match(/^(\d{4})(?:-(\d{4})?)?$/); if (yearMatch) { const startYear = yearMatch[1]; const endYear = yearMatch[2] || startYear; if (startYear) { filters.push(`from-pub-date:${startYear}`); } if (endYear && endYear !== startYear) { filters.push(`until-pub-date:${endYear}`); } } } // Add filters if (filters.length > 0) { params.filter = filters.join(','); } // Sorting const sortMapping: Record<string, string> = { 'relevance': 'relevance', 'date': 'published', 'citations': 'is-referenced-by-count' }; params.sort = sortMapping[options.sortBy || 'relevance'] || 'relevance'; params.order = options.sortOrder === 'asc' ? 'asc' : 'desc'; try { const response = await this.client.get('', { params }); if (response.status === 200 && response.data?.message?.items) { return this.parseSearchResponse(response.data); } return []; } catch (error: any) { this.handleHttpError(error, 'search'); } }
- src/mcp/searchers.ts:13-76 (helper)Imports and instantiates the CrossrefSearcher, making it available as searchers.crossref for use in tool handlers.import { CrossrefSearcher } from '../platforms/CrossrefSearcher.js'; import { logDebug } from '../utils/Logger.js'; export interface Searchers { arxiv: ArxivSearcher; webofscience: WebOfScienceSearcher; pubmed: PubMedSearcher; wos: WebOfScienceSearcher; biorxiv: BioRxivSearcher; medrxiv: MedRxivSearcher; semantic: SemanticScholarSearcher; iacr: IACRSearcher; googlescholar: GoogleScholarSearcher; scholar: GoogleScholarSearcher; scihub: SciHubSearcher; sciencedirect: ScienceDirectSearcher; springer: SpringerSearcher; wiley: WileySearcher; scopus: ScopusSearcher; crossref: CrossrefSearcher; } let searchers: Searchers | null = null; export function initializeSearchers(): Searchers { if (searchers) return searchers; logDebug('Initializing searchers...'); const arxivSearcher = new ArxivSearcher(); const wosSearcher = new WebOfScienceSearcher(process.env.WOS_API_KEY, process.env.WOS_API_VERSION); const pubmedSearcher = new PubMedSearcher(process.env.PUBMED_API_KEY); const biorxivSearcher = new BioRxivSearcher('biorxiv'); const medrxivSearcher = new MedRxivSearcher(); const semanticSearcher = new SemanticScholarSearcher(process.env.SEMANTIC_SCHOLAR_API_KEY); const iacrSearcher = new IACRSearcher(); const googleScholarSearcher = new GoogleScholarSearcher(); const sciHubSearcher = new SciHubSearcher(); const scienceDirectSearcher = new ScienceDirectSearcher(process.env.ELSEVIER_API_KEY); const springerSearcher = new SpringerSearcher( process.env.SPRINGER_API_KEY, process.env.SPRINGER_OPENACCESS_API_KEY ); const wileySearcher = new WileySearcher(process.env.WILEY_TDM_TOKEN); const scopusSearcher = new ScopusSearcher(process.env.ELSEVIER_API_KEY); const crossrefSearcher = new CrossrefSearcher(process.env.CROSSREF_MAILTO); searchers = { arxiv: arxivSearcher, webofscience: wosSearcher, pubmed: pubmedSearcher, wos: wosSearcher, biorxiv: biorxivSearcher, medrxiv: medrxivSearcher, semantic: semanticSearcher, iacr: iacrSearcher, googlescholar: googleScholarSearcher, scholar: googleScholarSearcher, scihub: sciHubSearcher, sciencedirect: scienceDirectSearcher, springer: springerSearcher, wiley: wileySearcher, scopus: scopusSearcher, crossref: crossrefSearcher