Update mcp/pubmed.py
Browse files- mcp/pubmed.py +5 -1
mcp/pubmed.py
CHANGED
@@ -60,7 +60,11 @@ async def fetch_pubmed(query: str, max_results: int = 5):
|
|
60 |
# Robustly extract summary/abstract
|
61 |
abstract = art.get("Abstract", {}).get("AbstractText", "")
|
62 |
if isinstance(abstract, list):
|
63 |
-
|
|
|
|
|
|
|
|
|
64 |
elif isinstance(abstract, dict):
|
65 |
summary = abstract.get("#text", "")
|
66 |
else:
|
|
|
60 |
# Robustly extract summary/abstract
|
61 |
abstract = art.get("Abstract", {}).get("AbstractText", "")
|
62 |
if isinstance(abstract, list):
|
63 |
+
# List of dicts or strings
|
64 |
+
summary = " ".join(
|
65 |
+
a.get("#text", str(a)) if isinstance(a, dict) else str(a)
|
66 |
+
for a in abstract
|
67 |
+
)
|
68 |
elif isinstance(abstract, dict):
|
69 |
summary = abstract.get("#text", "")
|
70 |
else:
|