tooluniverse 1.0.4__py3-none-any.whl → 1.0.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tooluniverse might be problematic. Click here for more details.
- tooluniverse/__init__.py +56 -5
- tooluniverse/agentic_tool.py +90 -14
- tooluniverse/arxiv_tool.py +113 -0
- tooluniverse/biorxiv_tool.py +97 -0
- tooluniverse/core_tool.py +153 -0
- tooluniverse/crossref_tool.py +73 -0
- tooluniverse/data/agentic_tools.json +2 -2
- tooluniverse/data/arxiv_tools.json +87 -0
- tooluniverse/data/biorxiv_tools.json +70 -0
- tooluniverse/data/core_tools.json +105 -0
- tooluniverse/data/crossref_tools.json +70 -0
- tooluniverse/data/dblp_tools.json +73 -0
- tooluniverse/data/doaj_tools.json +94 -0
- tooluniverse/data/fatcat_tools.json +72 -0
- tooluniverse/data/hal_tools.json +70 -0
- tooluniverse/data/medrxiv_tools.json +70 -0
- tooluniverse/data/odphp_tools.json +354 -0
- tooluniverse/data/openaire_tools.json +85 -0
- tooluniverse/data/osf_preprints_tools.json +77 -0
- tooluniverse/data/pmc_tools.json +109 -0
- tooluniverse/data/pubmed_tools.json +65 -0
- tooluniverse/data/unpaywall_tools.json +86 -0
- tooluniverse/data/wikidata_sparql_tools.json +42 -0
- tooluniverse/data/zenodo_tools.json +82 -0
- tooluniverse/dblp_tool.py +62 -0
- tooluniverse/default_config.py +18 -0
- tooluniverse/doaj_tool.py +124 -0
- tooluniverse/execute_function.py +70 -9
- tooluniverse/fatcat_tool.py +66 -0
- tooluniverse/hal_tool.py +77 -0
- tooluniverse/llm_clients.py +487 -0
- tooluniverse/mcp_tool_registry.py +3 -3
- tooluniverse/medrxiv_tool.py +97 -0
- tooluniverse/odphp_tool.py +226 -0
- tooluniverse/openaire_tool.py +145 -0
- tooluniverse/osf_preprints_tool.py +67 -0
- tooluniverse/pmc_tool.py +181 -0
- tooluniverse/pubmed_tool.py +110 -0
- tooluniverse/remote/boltz/boltz_mcp_server.py +2 -2
- tooluniverse/remote/uspto_downloader/uspto_downloader_mcp_server.py +2 -2
- tooluniverse/smcp.py +313 -191
- tooluniverse/smcp_server.py +4 -7
- tooluniverse/test/test_claude_sdk.py +93 -0
- tooluniverse/test/test_odphp_tool.py +166 -0
- tooluniverse/test/test_openrouter_client.py +288 -0
- tooluniverse/test/test_stdio_hooks.py +1 -1
- tooluniverse/test/test_tool_finder.py +1 -1
- tooluniverse/unpaywall_tool.py +63 -0
- tooluniverse/wikidata_sparql_tool.py +61 -0
- tooluniverse/zenodo_tool.py +74 -0
- {tooluniverse-1.0.4.dist-info → tooluniverse-1.0.6.dist-info}/METADATA +101 -74
- {tooluniverse-1.0.4.dist-info → tooluniverse-1.0.6.dist-info}/RECORD +56 -19
- {tooluniverse-1.0.4.dist-info → tooluniverse-1.0.6.dist-info}/entry_points.txt +1 -0
- tooluniverse-1.0.6.dist-info/licenses/LICENSE +201 -0
- tooluniverse-1.0.4.dist-info/licenses/LICENSE +0 -21
- {tooluniverse-1.0.4.dist-info → tooluniverse-1.0.6.dist-info}/WHEEL +0 -0
- {tooluniverse-1.0.4.dist-info → tooluniverse-1.0.6.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
from .base_tool import BaseTool
|
|
3
|
+
from .tool_registry import register_tool
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@register_tool("PubMedTool")
|
|
7
|
+
class PubMedTool(BaseTool):
|
|
8
|
+
"""
|
|
9
|
+
Search PubMed using NCBI E-utilities (esearch + esummary) and return
|
|
10
|
+
articles.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
def __init__(self, tool_config):
|
|
14
|
+
super().__init__(tool_config)
|
|
15
|
+
self.esearch_url = (
|
|
16
|
+
"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi"
|
|
17
|
+
)
|
|
18
|
+
self.esummary_url = (
|
|
19
|
+
"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi"
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
def run(self, arguments):
|
|
23
|
+
query = arguments.get("query")
|
|
24
|
+
limit = int(arguments.get("limit", 10))
|
|
25
|
+
api_key = arguments.get("api_key") # optional NCBI API key
|
|
26
|
+
if not query:
|
|
27
|
+
return {"error": "`query` parameter is required."}
|
|
28
|
+
return self._search(query, limit, api_key)
|
|
29
|
+
|
|
30
|
+
def _search(self, query, limit, api_key=None):
|
|
31
|
+
params = {
|
|
32
|
+
"db": "pubmed",
|
|
33
|
+
"term": query,
|
|
34
|
+
"retmax": max(1, min(limit, 200)),
|
|
35
|
+
"retmode": "json",
|
|
36
|
+
}
|
|
37
|
+
if api_key:
|
|
38
|
+
params["api_key"] = api_key
|
|
39
|
+
|
|
40
|
+
try:
|
|
41
|
+
r = requests.get(self.esearch_url, params=params, timeout=20)
|
|
42
|
+
except requests.RequestException as e:
|
|
43
|
+
return {
|
|
44
|
+
"error": "Network error calling PubMed esearch",
|
|
45
|
+
"reason": str(e),
|
|
46
|
+
}
|
|
47
|
+
if r.status_code != 200:
|
|
48
|
+
return {
|
|
49
|
+
"error": f"PubMed esearch error {r.status_code}",
|
|
50
|
+
"reason": r.reason,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
data = r.json()
|
|
54
|
+
id_list = data.get("esearchresult", {}).get("idlist", [])
|
|
55
|
+
if not id_list:
|
|
56
|
+
return []
|
|
57
|
+
|
|
58
|
+
summary_params = {
|
|
59
|
+
"db": "pubmed",
|
|
60
|
+
"id": ",".join(id_list),
|
|
61
|
+
"retmode": "json",
|
|
62
|
+
}
|
|
63
|
+
if api_key:
|
|
64
|
+
summary_params["api_key"] = api_key
|
|
65
|
+
|
|
66
|
+
try:
|
|
67
|
+
s = requests.get(
|
|
68
|
+
self.esummary_url,
|
|
69
|
+
params=summary_params,
|
|
70
|
+
timeout=20,
|
|
71
|
+
)
|
|
72
|
+
except requests.RequestException as e:
|
|
73
|
+
return {
|
|
74
|
+
"error": "Network error calling PubMed esummary",
|
|
75
|
+
"reason": str(e),
|
|
76
|
+
}
|
|
77
|
+
if s.status_code != 200:
|
|
78
|
+
return {
|
|
79
|
+
"error": f"PubMed esummary error {s.status_code}",
|
|
80
|
+
"reason": s.reason,
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
result = s.json().get("result", {})
|
|
84
|
+
uids = result.get("uids", [])
|
|
85
|
+
articles = []
|
|
86
|
+
for uid in uids:
|
|
87
|
+
rec = result.get(uid, {})
|
|
88
|
+
title = rec.get("title")
|
|
89
|
+
journal = rec.get("fulljournalname") or rec.get("source")
|
|
90
|
+
year = None
|
|
91
|
+
pubdate = rec.get("pubdate")
|
|
92
|
+
if pubdate and len(pubdate) >= 4 and pubdate[:4].isdigit():
|
|
93
|
+
year = int(pubdate[:4])
|
|
94
|
+
doi = None
|
|
95
|
+
for id_obj in rec.get("articleids", []):
|
|
96
|
+
if id_obj.get("idtype") == "doi":
|
|
97
|
+
doi = id_obj.get("value")
|
|
98
|
+
break
|
|
99
|
+
url = f"https://pubmed.ncbi.nlm.nih.gov/{uid}/"
|
|
100
|
+
articles.append(
|
|
101
|
+
{
|
|
102
|
+
"title": title,
|
|
103
|
+
"journal": journal,
|
|
104
|
+
"year": year,
|
|
105
|
+
"doi": doi,
|
|
106
|
+
"url": url,
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return articles
|
|
@@ -17,7 +17,7 @@ except FileNotFoundError as e:
|
|
|
17
17
|
)
|
|
18
18
|
sys.exit(1)
|
|
19
19
|
|
|
20
|
-
server = FastMCP("Your MCP Server"
|
|
20
|
+
server = FastMCP("Your MCP Server")
|
|
21
21
|
agents = {}
|
|
22
22
|
for tool_config in boltz_tools:
|
|
23
23
|
agents[tool_config["name"]] = Boltz2DockingTool(tool_config=tool_config)
|
|
@@ -47,4 +47,4 @@ def run_boltz2(query: dict):
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
if __name__ == "__main__":
|
|
50
|
-
server.run(transport="streamable-http", host="0.0.0.0", port=8080)
|
|
50
|
+
server.run(transport="streamable-http", host="0.0.0.0", port=8080, stateless_http=True)
|
|
@@ -18,7 +18,7 @@ except FileNotFoundError as e:
|
|
|
18
18
|
)
|
|
19
19
|
sys.exit(1)
|
|
20
20
|
|
|
21
|
-
server = FastMCP("Your MCP Server"
|
|
21
|
+
server = FastMCP("Your MCP Server")
|
|
22
22
|
agents = {}
|
|
23
23
|
for tool_config in uspto_downloader_tools:
|
|
24
24
|
agents[tool_config["name"]] = USPTOPatentDocumentDownloader(tool_config=tool_config)
|
|
@@ -58,4 +58,4 @@ def download_full_text(query: dict):
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
if __name__ == "__main__":
|
|
61
|
-
server.run(transport="streamable-http", host="0.0.0.0", port=8081)
|
|
61
|
+
server.run(transport="streamable-http", host="0.0.0.0", port=8081, stateless_http=True)
|