search_arxiv
Search and retrieve academic papers and preprints from arXiv repository. Find research studies, technical papers, and scientific literature by querying topics, authors, or specific fields like AI, physics, and mathematics.
Instructions
Search academic papers and preprints on arXiv repository. Perfect for finding research papers, scientific studies, technical papers, and academic literature. Use this when researching scientific topics, looking for papers by specific authors, or finding the latest research in fields like AI, physics, mathematics, computer science, etc. 💡 Tip: Use parallel_search_arxiv if you need to run multiple arXiv searches simultaneously.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| num | No | Maximum number of academic papers to return, between 1-100 | |
| query | Yes | Academic search terms, author names, or research topics (e.g., 'transformer neural networks', 'Einstein relativity', 'machine learning optimization') | |
| tbs | No | Time-based search parameter, e.g., 'qdr:h' for past hour, can be qdr:h, qdr:d, qdr:w, qdr:m, qdr:y |
Implementation Reference
- src/tools/jina-tools.ts:363-414 (registration)Full registration of the 'search_arxiv' tool including description, Zod schema for input validation, and the handler function that supports single queries or parallel execution via executeArxivSearch utility.server.tool( "search_arxiv", "Search academic papers and preprints on arXiv repository. Perfect for finding research papers, scientific studies, technical papers, and academic literature. Use this when researching scientific topics, looking for papers by specific authors, or finding the latest research in fields like AI, physics, mathematics, computer science, etc.", { query: z.union([z.string(), z.array(z.string())]).describe("Academic search terms, author names, or research topics (e.g., 'transformer neural networks', 'Einstein relativity', 'machine learning optimization'). Can be a single query string or an array of queries for parallel search."), num: z.number().default(30).describe("Maximum number of academic papers to return, between 1-100"), tbs: z.string().optional().describe("Time-based search parameter, e.g., 'qdr:h' for past hour, can be qdr:h, qdr:d, qdr:w, qdr:m, qdr:y") }, async ({ query, num, tbs }: { query: string | string[]; num: number; tbs?: string }) => { try { const props = getProps(); const tokenError = checkBearerToken(props.bearerToken); if (tokenError) { return tokenError; } // Handle single query or single-element array if (typeof query === 'string' || (Array.isArray(query) && query.length === 1)) { const singleQuery = typeof query === 'string' ? query : query[0]; const searchResult = await executeArxivSearch({ query: singleQuery, num, tbs }, props.bearerToken); return { content: formatSingleSearchResultToContentItems(searchResult), }; } // Handle multiple queries with parallel search if (Array.isArray(query) && query.length > 1) { const searches = query.map(q => ({ query: q, num, tbs })); const uniqueSearches = searches.filter((search, index, self) => index === self.findIndex(s => s.query === search.query) ); const arxivSearchFunction = async (searchArgs: SearchArxivArgs) => { return executeArxivSearch(searchArgs, props.bearerToken); }; const results = await executeParallelSearches(uniqueSearches, arxivSearchFunction, { timeout: 30000 }); return { content: formatParallelSearchResultsToContentItems(results), }; } return createErrorResponse("Invalid query format"); } catch (error) { return createErrorResponse(`Error: ${error instanceof Error ? error.message : String(error)}`); } }, );
- src/utils/search.ts:16-20 (schema)TypeScript interface SearchArxivArgs defining the expected input parameters for the arXiv search tool, used for type annotations in the handler and helpers.export interface SearchArxivArgs { query: string; num?: number; tbs?: string; }
- src/utils/search.ts:97-126 (helper)Core helper function that performs the actual arXiv search by making an API call to Jina AI's search endpoint with 'domain: arxiv'. Handles errors and formats results.export async function executeArxivSearch( searchArgs: SearchArxivArgs, bearerToken: string ): Promise<SearchResultOrError> { try { const response = await fetch('https://svip.jina.ai/', { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': `Bearer ${bearerToken}`, }, body: JSON.stringify({ q: searchArgs.query, domain: 'arxiv', num: searchArgs.num || 30, ...(searchArgs.tbs && { tbs: searchArgs.tbs }) }), }); if (!response.ok) { return { error: `arXiv search failed for query "${searchArgs.query}": ${response.statusText}` }; } const data = await response.json() as any; return { query: searchArgs.query, results: data.results || [] }; } catch (error) { return { error: `arXiv search failed for query "${searchArgs.query}": ${error instanceof Error ? error.message : String(error)}` }; } }