mgbam commited on
Commit
3c2582f
·
verified ·
1 Parent(s): 95358c2

Update mcp/arxiv.py

Browse files
Files changed (1) hide show
  1. mcp/arxiv.py +5 -5
mcp/arxiv.py CHANGED
@@ -13,11 +13,11 @@ async def fetch_arxiv(query: str, max_results: int = 5):
13
  results = []
14
  for entry in feed.entries:
15
  results.append({
16
- "title": entry.title,
17
- "authors": ", ".join([a.name for a in entry.authors]) if hasattr(entry, 'authors') else "",
18
- "summary": entry.summary,
19
- "link": entry.link,
20
- "published": entry.get("published", ""), # <--- THIS FIXES THE ERROR!
21
  "source": "arXiv"
22
  })
23
  return results
 
13
  results = []
14
  for entry in feed.entries:
15
  results.append({
16
+ "title": getattr(entry, "title", ""),
17
+ "authors": ", ".join([a.name for a in getattr(entry, "authors", [])]) if hasattr(entry, 'authors') else "",
18
+ "summary": getattr(entry, "summary", ""),
19
+ "link": getattr(entry, "link", ""),
20
+ "published": entry.get("published", "") if hasattr(entry, 'get') else getattr(entry, "published", ""),
21
  "source": "arXiv"
22
  })
23
  return results