get_today_papers
Retrieve today's machine learning research papers from HuggingFace to stay current with academic developments.
Instructions
Get today's HuggingFace daily papers
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- main.py:133-161 (handler)MCP server.call_tool handler implementation for 'get_today_papers': fetches papers from scraper, handles empty case, formats detailed markdown list of papers with title, authors, abstract, URL, PDF, votes, and submitter.elif name == "get_today_papers": papers = scraper.get_today_papers() today = datetime.now().strftime("%Y-%m-%d") if not papers: return [ types.TextContent( type="text", text=f"No papers found for today ({today}). Papers might not be published yet or there could be a network issue." ) ] return [ types.TextContent( type="text", text=f"Today's Papers ({today}) - Found {len(papers)} papers:\n\n" + "\n".join([ f"Title: {paper['title']}\n" f"Authors: {', '.join(paper['authors'])}\n" f"Abstract: {paper['abstract']}\n" f"URL: {paper['url']}\n" f"PDF: {paper['pdf_url']}\n" f"Votes: {paper['votes']}\n" f"Submitted by: {paper['submitted_by']}\n" + "-" * 50 for paper in papers ]) ) ]
- main.py:75-82 (registration)Registration of the 'get_today_papers' tool in server.list_tools(), including name, description, and input schema (no required properties).types.Tool( name="get_today_papers", description="Get today's HuggingFace daily papers", inputSchema={ "type": "object", "properties": {}, }, ),
- main.py:78-81 (schema)Input schema for 'get_today_papers' tool: empty object with no properties.inputSchema={ "type": "object", "properties": {}, },
- scraper.py:40-42 (helper)Core scraper method get_today_papers(): computes today's date and delegates to get_papers_by_date (the actual scraping logic). Called by MCP tool handler.def get_today_papers(self, fetch_details: bool = True) -> List[Dict]: today = datetime.now().strftime("%Y-%m-%d") return self.get_papers_by_date(today, fetch_details)
- scraper.py:19-39 (helper)Supporting scraper method get_papers_by_date(): fetches HTML from HF papers page, parses papers, optionally fetches details (abstract, PDF, authors from arXiv), used by get_today_papers.def get_papers_by_date(self, date: str, fetch_details: bool = True) -> List[Dict]: url = f"{self.base_url}/{date}" try: response = self.session.get(url) response.raise_for_status() papers = self._parse_papers(response.text) if fetch_details and papers: # 获取所有论文的详细信息,包括具体作者姓名 for i, paper in enumerate(papers): if paper.get('url'): details = self._fetch_paper_details(paper['url']) if details: paper.update(details) time.sleep(1) # 避免请求过快 return papers except requests.RequestException as e: logging.error(f"Failed to fetch papers for {date}: {e}") return []