Skip to main content
Glama

search_papers

Search for cryptographic research papers in the IACR Cryptology ePrint Archive by query, year, or category, and retrieve relevant results programmatically.

Instructions

Search for papers in the IACR Cryptology ePrint Archive

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNo
max_resultsNo
queryYes
yearNo

Implementation Reference

  • The main handler function that implements the search_papers tool: validates args, fetches IACR ePrint RSS feed, parses XML, filters papers by query, optional year/category/max_results, returns JSON list of matching papers.
    private async searchPapers(args: unknown) {
      const validatedArgs = SearchPapersSchema.parse(args);
      
      try {
        // Fetch RSS feed with comprehensive headers
        const response = await axios.get(IACR_RSS_URL, {
          headers: {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
            'Accept': 'application/xml,text/xml,*/*;q=0.8',
            'Accept-Language': 'en-US,en;q=0.9'
          },
          timeout: 15000
        });
    
        // Parse XML feed
        const parsedFeed = await parseStringPromise(response.data);
        
        // Ensure items exist
        if (!parsedFeed.rss?.channel?.[0]?.item) {
          console.error('No items found in RSS feed');
          return { content: [{ type: 'text', text: '[]' }] };
        }
    
        // Current year for filtering
        const currentYear = new Date().getFullYear();
    
        // Extract and filter papers
        const papers = parsedFeed.rss.channel[0].item
          .map((item: any) => ({
            id: item.link[0].split('/').pop(),
            title: item.title[0],
            authors: item['dc:creator'] ? item['dc:creator'][0] : 'Unknown',
            link: item.link[0],
            description: item.description[0],
            pubDate: item.pubDate[0]
          }))
          .filter((paper: IACRPaper) => {
            const title = paper.title.toLowerCase();
            const description = paper.description.toLowerCase();
            const query = validatedArgs.query.toLowerCase();
            
            // Query matching
            const matchesQuery = title.includes(query) || description.includes(query);
            
            // Year filtering
            const paperYear = new Date(paper.pubDate).getFullYear();
            const matchesYear = !validatedArgs.year || 
              (validatedArgs.year && paperYear === validatedArgs.year) ||
              (paperYear >= currentYear - 10);
            
            return matchesQuery && matchesYear;
          })
          .slice(0, validatedArgs.max_results)
          .map((paper: IACRPaper) => ({
            id: paper.id,
            title: paper.title,
            authors: paper.authors,
            year: new Date(paper.pubDate).getFullYear(),
            link: paper.link,
            abstract: paper.description
          }));
    
        // Log results for debugging
        console.error('Search Results:', JSON.stringify(papers, null, 2));
    
        return {
          content: [{
            type: 'text',
            text: JSON.stringify(papers, null, 2)
          }]
        };
      } catch (error) {
        // Comprehensive error logging
        console.error('Search Error:', error);
    
        throw new McpError(
          ErrorCode.InternalError,
          `Search failed: ${error instanceof Error ? error.message : 'Unknown error'}`
        );
      }
    }
  • Zod schema defining the input parameters for search_papers: query (required string), optional year (number), category (string), max_results (number, default 20).
    const SearchPapersSchema = z.object({
      query: z.string(),
      year: z.number().optional(),
      category: z.string().optional(),
      max_results: z.number().optional().default(20)
    });
  • src/index.ts:67-80 (registration)
    Tool registration in the listTools handler: defines name, description, and inputSchema for search_papers.
    {
      name: 'search_papers',
      description: 'Search for papers in the IACR Cryptology ePrint Archive',
      inputSchema: {
        type: 'object',
        properties: {
          query: { type: 'string' },
          year: { type: 'number' },
          category: { type: 'string' },
          max_results: { type: 'number', default: 20 }
        },
        required: ['query']
      }
    },
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/doomdagadiggiedahdah/iacr-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server