tooluniverse 0.1.4__py3-none-any.whl โ†’ 1.0.0__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.

Files changed (187) hide show
  1. tooluniverse/__init__.py +340 -4
  2. tooluniverse/admetai_tool.py +84 -0
  3. tooluniverse/agentic_tool.py +563 -0
  4. tooluniverse/alphafold_tool.py +96 -0
  5. tooluniverse/base_tool.py +129 -6
  6. tooluniverse/boltz_tool.py +207 -0
  7. tooluniverse/chem_tool.py +192 -0
  8. tooluniverse/compose_scripts/__init__.py +1 -0
  9. tooluniverse/compose_scripts/biomarker_discovery.py +293 -0
  10. tooluniverse/compose_scripts/comprehensive_drug_discovery.py +186 -0
  11. tooluniverse/compose_scripts/drug_safety_analyzer.py +89 -0
  12. tooluniverse/compose_scripts/literature_tool.py +34 -0
  13. tooluniverse/compose_scripts/output_summarizer.py +279 -0
  14. tooluniverse/compose_scripts/tool_description_optimizer.py +681 -0
  15. tooluniverse/compose_scripts/tool_discover.py +705 -0
  16. tooluniverse/compose_scripts/tool_graph_composer.py +448 -0
  17. tooluniverse/compose_tool.py +371 -0
  18. tooluniverse/ctg_tool.py +1002 -0
  19. tooluniverse/custom_tool.py +81 -0
  20. tooluniverse/dailymed_tool.py +108 -0
  21. tooluniverse/data/admetai_tools.json +155 -0
  22. tooluniverse/data/agentic_tools.json +1156 -0
  23. tooluniverse/data/alphafold_tools.json +87 -0
  24. tooluniverse/data/boltz_tools.json +9 -0
  25. tooluniverse/data/chembl_tools.json +16 -0
  26. tooluniverse/data/clait_tools.json +108 -0
  27. tooluniverse/data/clinicaltrials_gov_tools.json +326 -0
  28. tooluniverse/data/compose_tools.json +202 -0
  29. tooluniverse/data/dailymed_tools.json +70 -0
  30. tooluniverse/data/dataset_tools.json +646 -0
  31. tooluniverse/data/disease_target_score_tools.json +712 -0
  32. tooluniverse/data/efo_tools.json +17 -0
  33. tooluniverse/data/embedding_tools.json +319 -0
  34. tooluniverse/data/enrichr_tools.json +31 -0
  35. tooluniverse/data/europe_pmc_tools.json +22 -0
  36. tooluniverse/data/expert_feedback_tools.json +10 -0
  37. tooluniverse/data/fda_drug_adverse_event_tools.json +491 -0
  38. tooluniverse/data/fda_drug_labeling_tools.json +544 -168
  39. tooluniverse/data/fda_drugs_with_brand_generic_names_for_tool.py +76929 -148860
  40. tooluniverse/data/finder_tools.json +209 -0
  41. tooluniverse/data/gene_ontology_tools.json +113 -0
  42. tooluniverse/data/gwas_tools.json +1082 -0
  43. tooluniverse/data/hpa_tools.json +333 -0
  44. tooluniverse/data/humanbase_tools.json +47 -0
  45. tooluniverse/data/idmap_tools.json +74 -0
  46. tooluniverse/data/mcp_client_tools_example.json +113 -0
  47. tooluniverse/data/mcpautoloadertool_defaults.json +28 -0
  48. tooluniverse/data/medlineplus_tools.json +141 -0
  49. tooluniverse/data/monarch_tools.json +1 -1
  50. tooluniverse/data/openalex_tools.json +36 -0
  51. tooluniverse/data/opentarget_tools.json +82 -58
  52. tooluniverse/data/output_summarization_tools.json +101 -0
  53. tooluniverse/data/packages/bioinformatics_core_tools.json +1756 -0
  54. tooluniverse/data/packages/categorized_tools.txt +206 -0
  55. tooluniverse/data/packages/cheminformatics_tools.json +347 -0
  56. tooluniverse/data/packages/earth_sciences_tools.json +74 -0
  57. tooluniverse/data/packages/genomics_tools.json +776 -0
  58. tooluniverse/data/packages/image_processing_tools.json +38 -0
  59. tooluniverse/data/packages/machine_learning_tools.json +789 -0
  60. tooluniverse/data/packages/neuroscience_tools.json +62 -0
  61. tooluniverse/data/packages/original_tools.txt +0 -0
  62. tooluniverse/data/packages/physics_astronomy_tools.json +62 -0
  63. tooluniverse/data/packages/scientific_computing_tools.json +560 -0
  64. tooluniverse/data/packages/single_cell_tools.json +453 -0
  65. tooluniverse/data/packages/software_tools.json +4954 -0
  66. tooluniverse/data/packages/structural_biology_tools.json +396 -0
  67. tooluniverse/data/packages/visualization_tools.json +399 -0
  68. tooluniverse/data/pubchem_tools.json +215 -0
  69. tooluniverse/data/pubtator_tools.json +68 -0
  70. tooluniverse/data/rcsb_pdb_tools.json +1332 -0
  71. tooluniverse/data/reactome_tools.json +19 -0
  72. tooluniverse/data/semantic_scholar_tools.json +26 -0
  73. tooluniverse/data/special_tools.json +2 -25
  74. tooluniverse/data/tool_composition_tools.json +88 -0
  75. tooluniverse/data/toolfinderkeyword_defaults.json +34 -0
  76. tooluniverse/data/txagent_client_tools.json +9 -0
  77. tooluniverse/data/uniprot_tools.json +211 -0
  78. tooluniverse/data/url_fetch_tools.json +94 -0
  79. tooluniverse/data/uspto_downloader_tools.json +9 -0
  80. tooluniverse/data/uspto_tools.json +811 -0
  81. tooluniverse/data/xml_tools.json +3275 -0
  82. tooluniverse/dataset_tool.py +296 -0
  83. tooluniverse/default_config.py +165 -0
  84. tooluniverse/efo_tool.py +42 -0
  85. tooluniverse/embedding_database.py +630 -0
  86. tooluniverse/embedding_sync.py +396 -0
  87. tooluniverse/enrichr_tool.py +266 -0
  88. tooluniverse/europe_pmc_tool.py +52 -0
  89. tooluniverse/execute_function.py +1775 -95
  90. tooluniverse/extended_hooks.py +444 -0
  91. tooluniverse/gene_ontology_tool.py +194 -0
  92. tooluniverse/graphql_tool.py +158 -36
  93. tooluniverse/gwas_tool.py +358 -0
  94. tooluniverse/hpa_tool.py +1645 -0
  95. tooluniverse/humanbase_tool.py +389 -0
  96. tooluniverse/logging_config.py +254 -0
  97. tooluniverse/mcp_client_tool.py +764 -0
  98. tooluniverse/mcp_integration.py +413 -0
  99. tooluniverse/mcp_tool_registry.py +925 -0
  100. tooluniverse/medlineplus_tool.py +337 -0
  101. tooluniverse/openalex_tool.py +228 -0
  102. tooluniverse/openfda_adv_tool.py +283 -0
  103. tooluniverse/openfda_tool.py +393 -160
  104. tooluniverse/output_hook.py +1122 -0
  105. tooluniverse/package_tool.py +195 -0
  106. tooluniverse/pubchem_tool.py +158 -0
  107. tooluniverse/pubtator_tool.py +168 -0
  108. tooluniverse/rcsb_pdb_tool.py +38 -0
  109. tooluniverse/reactome_tool.py +108 -0
  110. tooluniverse/remote/boltz/boltz_mcp_server.py +50 -0
  111. tooluniverse/remote/depmap_24q2/depmap_24q2_mcp_tool.py +442 -0
  112. tooluniverse/remote/expert_feedback/human_expert_mcp_tools.py +2013 -0
  113. tooluniverse/remote/expert_feedback/simple_test.py +23 -0
  114. tooluniverse/remote/expert_feedback/start_web_interface.py +188 -0
  115. tooluniverse/remote/expert_feedback/web_only_interface.py +0 -0
  116. tooluniverse/remote/expert_feedback_mcp/human_expert_mcp_server.py +1611 -0
  117. tooluniverse/remote/expert_feedback_mcp/simple_test.py +34 -0
  118. tooluniverse/remote/expert_feedback_mcp/start_web_interface.py +91 -0
  119. tooluniverse/remote/immune_compass/compass_tool.py +327 -0
  120. tooluniverse/remote/pinnacle/pinnacle_tool.py +328 -0
  121. tooluniverse/remote/transcriptformer/transcriptformer_tool.py +586 -0
  122. tooluniverse/remote/uspto_downloader/uspto_downloader_mcp_server.py +61 -0
  123. tooluniverse/remote/uspto_downloader/uspto_downloader_tool.py +120 -0
  124. tooluniverse/remote_tool.py +99 -0
  125. tooluniverse/restful_tool.py +53 -30
  126. tooluniverse/scripts/generate_tool_graph.py +408 -0
  127. tooluniverse/scripts/visualize_tool_graph.py +829 -0
  128. tooluniverse/semantic_scholar_tool.py +62 -0
  129. tooluniverse/smcp.py +2452 -0
  130. tooluniverse/smcp_server.py +975 -0
  131. tooluniverse/test/mcp_server_test.py +0 -0
  132. tooluniverse/test/test_admetai_tool.py +370 -0
  133. tooluniverse/test/test_agentic_tool.py +129 -0
  134. tooluniverse/test/test_alphafold_tool.py +71 -0
  135. tooluniverse/test/test_chem_tool.py +37 -0
  136. tooluniverse/test/test_compose_lieraturereview.py +63 -0
  137. tooluniverse/test/test_compose_tool.py +448 -0
  138. tooluniverse/test/test_dailymed.py +69 -0
  139. tooluniverse/test/test_dataset_tool.py +200 -0
  140. tooluniverse/test/test_disease_target_score.py +56 -0
  141. tooluniverse/test/test_drugbank_filter_examples.py +179 -0
  142. tooluniverse/test/test_efo.py +31 -0
  143. tooluniverse/test/test_enrichr_tool.py +21 -0
  144. tooluniverse/test/test_europe_pmc_tool.py +20 -0
  145. tooluniverse/test/test_fda_adv.py +95 -0
  146. tooluniverse/test/test_fda_drug_labeling.py +91 -0
  147. tooluniverse/test/test_gene_ontology_tools.py +66 -0
  148. tooluniverse/test/test_gwas_tool.py +139 -0
  149. tooluniverse/test/test_hpa.py +625 -0
  150. tooluniverse/test/test_humanbase_tool.py +20 -0
  151. tooluniverse/test/test_idmap_tools.py +61 -0
  152. tooluniverse/test/test_mcp_server.py +211 -0
  153. tooluniverse/test/test_mcp_tool.py +247 -0
  154. tooluniverse/test/test_medlineplus.py +220 -0
  155. tooluniverse/test/test_openalex_tool.py +32 -0
  156. tooluniverse/test/test_opentargets.py +28 -0
  157. tooluniverse/test/test_pubchem_tool.py +116 -0
  158. tooluniverse/test/test_pubtator_tool.py +37 -0
  159. tooluniverse/test/test_rcsb_pdb_tool.py +86 -0
  160. tooluniverse/test/test_reactome.py +54 -0
  161. tooluniverse/test/test_semantic_scholar_tool.py +24 -0
  162. tooluniverse/test/test_software_tools.py +147 -0
  163. tooluniverse/test/test_tool_description_optimizer.py +49 -0
  164. tooluniverse/test/test_tool_finder.py +26 -0
  165. tooluniverse/test/test_tool_finder_llm.py +252 -0
  166. tooluniverse/test/test_tools_find.py +195 -0
  167. tooluniverse/test/test_uniprot_tools.py +74 -0
  168. tooluniverse/test/test_uspto_tool.py +72 -0
  169. tooluniverse/test/test_xml_tool.py +113 -0
  170. tooluniverse/tool_finder_embedding.py +267 -0
  171. tooluniverse/tool_finder_keyword.py +693 -0
  172. tooluniverse/tool_finder_llm.py +699 -0
  173. tooluniverse/tool_graph_web_ui.py +955 -0
  174. tooluniverse/tool_registry.py +416 -0
  175. tooluniverse/uniprot_tool.py +155 -0
  176. tooluniverse/url_tool.py +253 -0
  177. tooluniverse/uspto_tool.py +240 -0
  178. tooluniverse/utils.py +369 -41
  179. tooluniverse/xml_tool.py +369 -0
  180. tooluniverse-1.0.0.dist-info/METADATA +377 -0
  181. tooluniverse-1.0.0.dist-info/RECORD +186 -0
  182. {tooluniverse-0.1.4.dist-info โ†’ tooluniverse-1.0.0.dist-info}/WHEEL +1 -1
  183. tooluniverse-1.0.0.dist-info/entry_points.txt +9 -0
  184. tooluniverse-0.1.4.dist-info/METADATA +0 -141
  185. tooluniverse-0.1.4.dist-info/RECORD +0 -18
  186. {tooluniverse-0.1.4.dist-info โ†’ tooluniverse-1.0.0.dist-info}/licenses/LICENSE +0 -0
  187. {tooluniverse-0.1.4.dist-info โ†’ tooluniverse-1.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,61 @@
1
+ """
2
+ Concise Test Script - OpenTargets ID Mapping Tools
3
+ Test three main ID mapping tools:
4
+ 1. Get disease IDs by name
5
+ 2. Get cross-reference IDs by EFO ID
6
+ 3. Bidirectional mapping between external IDs and diseases
7
+ """
8
+
9
+ from tooluniverse import ToolUniverse
10
+
11
+
12
+ def main():
13
+ # Initialize tools
14
+ print("๐Ÿ”ง Initializing ToolUniverse...")
15
+ tooluni = ToolUniverse()
16
+ tooluni.load_tools()
17
+ print("โœ… Tools loaded successfully\n")
18
+
19
+ # Test cases
20
+ test_cases = [
21
+ {
22
+ "name": "OpenTargets_get_disease_ids_by_name",
23
+ "arguments": {"name": "neuroblastoma"},
24
+ "description": "Get disease IDs by name",
25
+ },
26
+ {
27
+ "name": "OpenTargets_get_disease_ids_by_efoId",
28
+ "arguments": {"efoId": "EFO_0000621"},
29
+ "description": "Get cross-references by EFO ID",
30
+ },
31
+ {
32
+ "name": "OpenTargets_map_any_disease_id_to_all_other_ids",
33
+ "arguments": {"inputId": "EFO_0000621"},
34
+ "description": "Map disease ID to all other IDs",
35
+ },
36
+ ]
37
+
38
+ # Run tests
39
+ print("๐Ÿงช Starting ID Mapping tools tests:\n")
40
+
41
+ for i, test in enumerate(test_cases, 1):
42
+ print(f"[{i}] {test['description']}")
43
+ print(f" Tool: {test['name']}")
44
+ print(f" Arguments: {test['arguments']}")
45
+
46
+ try:
47
+ result = tooluni.run(test)
48
+ if result:
49
+ print(" โœ… Success")
50
+ print(f" ๐Ÿ“Š Result: {str(result)}")
51
+ else:
52
+ print(" โš ๏ธ No data returned")
53
+ except Exception as e:
54
+ print(f" โŒ Failed: {str(e)}")
55
+ print()
56
+
57
+ print("๐ŸŽ‰ Testing completed!")
58
+
59
+
60
+ if __name__ == "__main__":
61
+ main()
@@ -0,0 +1,211 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Test script: Verify that the generated FastMCP server is working properly
4
+
5
+ This script will start the MCP server and send some test requests
6
+ """
7
+
8
+ import asyncio
9
+ import aiohttp
10
+ import sys
11
+ import subprocess
12
+ from pathlib import Path
13
+
14
+ # Test MCP server URL
15
+ MCP_SERVER_URL = "http://127.0.0.1:8000"
16
+
17
+
18
+ async def test_mcp_server():
19
+ """Test basic functionality of MCP server"""
20
+
21
+ print("๐Ÿš€ Starting FastMCP server test...")
22
+
23
+ # Wait for server to start
24
+ print("โณ Waiting for server to start...")
25
+ await asyncio.sleep(3)
26
+
27
+ async with aiohttp.ClientSession() as session:
28
+ # Test 1: Get tool list
29
+ print("\n๐Ÿ“‹ Test 1: Get available tool list")
30
+ tools_request = {
31
+ "jsonrpc": "2.0",
32
+ "id": "test-1",
33
+ "method": "tools/list",
34
+ "params": {},
35
+ }
36
+
37
+ try:
38
+ async with session.post(
39
+ f"{MCP_SERVER_URL}/mcp/",
40
+ json=tools_request,
41
+ headers={"Content-Type": "application/json"},
42
+ ) as response:
43
+ if response.status == 200:
44
+ result = await response.json()
45
+ tools = result.get("result", {}).get("tools", [])
46
+ print(
47
+ f"โœ… Successfully retrieved tool list, {len(tools)} tools in total"
48
+ )
49
+
50
+ # Show first few tools
51
+ for _i, tool in enumerate(tools[:3]):
52
+ print(
53
+ f" - {tool.get('name', 'unknown')}: {tool.get('description', 'no description')[:80]}..."
54
+ )
55
+
56
+ if len(tools) > 3:
57
+ print(f" ... and {len(tools) - 3} more tools")
58
+
59
+ else:
60
+ print(f"โŒ Failed to get tool list, status code: {response.status}")
61
+ print(f"Response: {await response.text()}")
62
+ return False
63
+
64
+ except Exception as e:
65
+ print(f"โŒ Failed to connect to server: {e}")
66
+ return False
67
+
68
+ # Test 2: Call a simple tool
69
+ print("\n๐Ÿ”ง Test 2: Call a tool function")
70
+ tool_request = {
71
+ "jsonrpc": "2.0",
72
+ "id": "test-2",
73
+ "method": "tools/call",
74
+ "params": {
75
+ "name": "get_phenotype_by_HPO_ID",
76
+ "arguments": {"id": "HP:0000001"}, # Test HPO ID
77
+ },
78
+ }
79
+
80
+ try:
81
+ async with session.post(
82
+ f"{MCP_SERVER_URL}/mcp/",
83
+ json=tool_request,
84
+ headers={"Content-Type": "application/json"},
85
+ ) as response:
86
+ if response.status == 200:
87
+ result = await response.json()
88
+ if "error" in result:
89
+ print(f"โš ๏ธ Tool execution returned error: {result['error']}")
90
+ else:
91
+ print("โœ… Tool call successful")
92
+ print(
93
+ f" Return result type: {type(result.get('result', {}))}"
94
+ )
95
+ else:
96
+ print(f"โŒ Tool call failed, status code: {response.status}")
97
+ print(f"Response: {await response.text()}")
98
+
99
+ except Exception as e:
100
+ print(f"โŒ Tool call exception: {e}")
101
+
102
+ # Test 3: Call FDA tool
103
+ print("\n๐Ÿ’Š Test 3: Call FDA drug query tool")
104
+ fda_request = {
105
+ "jsonrpc": "2.0",
106
+ "id": "test-3",
107
+ "method": "tools/call",
108
+ "params": {
109
+ "name": "FDA_get_active_ingredient_info_by_drug_name",
110
+ "arguments": {"drug_name": "aspirin", "limit": 5, "skip": 0},
111
+ },
112
+ }
113
+
114
+ try:
115
+ async with session.post(
116
+ f"{MCP_SERVER_URL}/mcp/",
117
+ json=fda_request,
118
+ headers={"Content-Type": "application/json"},
119
+ ) as response:
120
+ if response.status == 200:
121
+ result = await response.json()
122
+ if "error" in result:
123
+ print(
124
+ f"โš ๏ธ FDA tool execution returned error: {result['error']}"
125
+ )
126
+ else:
127
+ print("โœ… FDA tool call successful")
128
+ print(
129
+ f" Return result type: {type(result.get('result', {}))}"
130
+ )
131
+ else:
132
+ print(f"โŒ FDA tool call failed, status code: {response.status}")
133
+
134
+ except Exception as e:
135
+ print(f"โŒ FDA tool call exception: {e}")
136
+
137
+ print("\n๐ŸŽ‰ Test completed!")
138
+ return True
139
+
140
+
141
+ def start_mcp_server():
142
+ """Start MCP server"""
143
+ print("๐Ÿš€ Starting MCP server...")
144
+
145
+ # Modify the generated file, add correct startup code
146
+ server_file = Path(__file__).parent / "mcp_server_test.py"
147
+
148
+ server_code = """#!/usr/bin/env python3
149
+ # Import generated MCP wrapper
150
+ import sys
151
+ import os
152
+ sys.path.append(os.path.dirname(__file__))
153
+
154
+ # Read generated code and execute
155
+ with open("mcp_wrappers_generated.txt", "r") as f:
156
+ generated_code = f.read()
157
+
158
+ # Execute generated code
159
+ exec(generated_code)
160
+
161
+ # Start server
162
+ if __name__ == "__main__":
163
+ print("๐Ÿš€ Starting ToolUniverse MCP server...")
164
+ print(f"Server address: http://127.0.0.1:8000")
165
+ print("Press Ctrl+C to stop server")
166
+ run_server()
167
+ """
168
+
169
+ with open(server_file, "w") as f:
170
+ f.write(server_code)
171
+
172
+ # Start server process
173
+ return subprocess.Popen(
174
+ [sys.executable, str(server_file)],
175
+ stdout=subprocess.PIPE,
176
+ stderr=subprocess.PIPE,
177
+ )
178
+
179
+
180
+ async def main():
181
+ """Main function"""
182
+ print("๐Ÿงช FastMCP Server Test Tool")
183
+ print("=" * 50)
184
+
185
+ # Start server
186
+ server_process = start_mcp_server()
187
+
188
+ try:
189
+ # Run tests
190
+ success = await test_mcp_server()
191
+
192
+ if success:
193
+ print("\nโœ… All tests passed! MCP server is working properly.")
194
+ else:
195
+ print("\nโŒ Some tests failed, please check server configuration.")
196
+
197
+ except KeyboardInterrupt:
198
+ print("\nโน๏ธ Test interrupted by user")
199
+ finally:
200
+ # Cleanup: terminate server process
201
+ print("\n๐Ÿงน Cleanup: closing server...")
202
+ server_process.terminate()
203
+ try:
204
+ server_process.wait(timeout=5)
205
+ except subprocess.TimeoutExpired:
206
+ server_process.kill()
207
+ print("โœ… Server closed")
208
+
209
+
210
+ if __name__ == "__main__":
211
+ asyncio.run(main())
@@ -0,0 +1,247 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Test file for MCP Tools in ToolUniverse
4
+
5
+ This file tests the MCP (Model Context Protocol) integration functionality,
6
+ including MCPClientTool and MCPAutoLoaderTool.
7
+
8
+ Usage:
9
+ python test_mcp_tool.py
10
+ """
11
+
12
+ from tooluniverse import ToolUniverse
13
+ from typing import Any, Dict, List
14
+ import time
15
+ import json
16
+
17
+ # Step 1: Initialize tool universe
18
+ print("๐Ÿ”ง Initializing ToolUniverse...")
19
+ tooluni = ToolUniverse()
20
+ tooluni.load_tools()
21
+
22
+ print("โœ… ToolUniverse initialized successfully")
23
+ print(f"๐Ÿ“Š Total tools loaded: {len(tooluni.all_tool_dict)}")
24
+
25
+ # Step 2: Check if MCP tools are available
26
+ mcp_tools = [
27
+ name for name in list(tooluni.all_tool_dict.keys()) if "mcp" in name.lower()
28
+ ]
29
+ print(f"๐Ÿ” Found {len(mcp_tools)} MCP-related tools: {mcp_tools}")
30
+
31
+ # Step 3: Define test queries for MCP tools
32
+ test_queries: List[Dict[str, Any]] = [
33
+ # Test mock MCP tools (these should work without requiring external servers)
34
+ # {
35
+ # "name": "mcp_mock_calculator",
36
+ # "arguments": {
37
+ # "operation": "add",
38
+ # "a": 10,
39
+ # "b": 5
40
+ # }
41
+ # },
42
+ # {
43
+ # "name": "mcp_mock_greeter",
44
+ # "arguments": {
45
+ # "name": "ToolUniverse User"
46
+ # }
47
+ # },
48
+ # Test auto-discovered MCP tools from server 1
49
+ # {
50
+ # "name": "mcp_s1_calculate",
51
+ # "arguments": {
52
+ # "expression": "2 + 3 * 4"
53
+ # }
54
+ # },
55
+ # {
56
+ # "name": "mcp_s1_get_weather",
57
+ # "arguments": {
58
+ # "city": "New York",
59
+ # "units": "celsius"
60
+ # }
61
+ # },
62
+ # Test MCP client tool (if available)
63
+ # {
64
+ # "name": "mcp_client_example",
65
+ # "arguments": {
66
+ # "operation": "list_tools"
67
+ # }
68
+ # },
69
+ # Test MCPAutoLoaderTool - Discover tools (will show connection errors if servers not running)
70
+ # {
71
+ # "name": "mcp_auto_loader_server1",
72
+ # "arguments": {
73
+ # "operation": "discover"
74
+ # }
75
+ # },
76
+ # {
77
+ # "name": "mcp_mock_greeter",
78
+ # "arguments": {
79
+ # "name": "ToolUniverse User"
80
+ # }
81
+ # },
82
+ # # Test MCP client tool (if available)
83
+ # {
84
+ # "name": "mcp_client_example",
85
+ # "arguments": {
86
+ # "operation": "list_tools"
87
+ # }
88
+ # },
89
+ # # Test MCPAutoLoaderTool - Discover tools (will show connection errors if servers not running)
90
+ # {
91
+ # "name": "mcp_auto_loader_server1",
92
+ # "arguments": {
93
+ # "operation": "discover"
94
+ # }
95
+ # },
96
+ # Test MCP client with simple operations
97
+ # {
98
+ # "name": "mcp_client_example",
99
+ # "arguments": {
100
+ # "operation": "call_tool",
101
+ # "tool_name": "get_weather",
102
+ # "tool_arguments": {
103
+ # "city": "New York",
104
+ # "units": "celsius"
105
+ # }
106
+ # }
107
+ # },
108
+ # # Test calculator operation
109
+ # {
110
+ # "name": "mcp_client_example",
111
+ # "arguments": {
112
+ # "operation": "call_tool",
113
+ # "tool_name": "calculate",
114
+ # "tool_arguments": {
115
+ # "expression": "10 * 5 + 2"
116
+ # }
117
+ # }
118
+ # },
119
+ # # Test Official SDK server (if running)
120
+ # {
121
+ # "name": "mcp_auto_loader_official_sdk",
122
+ # "arguments": {
123
+ # "operation": "discover"
124
+ # }
125
+ # },
126
+ # # Test file listing operation
127
+ # {
128
+ # "name": "mcp_client_example",
129
+ # "arguments": {
130
+ # "operation": "call_tool",
131
+ # "tool_name": "list_files",
132
+ # "tool_arguments": {
133
+ # "directory": ".",
134
+ # "pattern": "*.py"
135
+ # }
136
+ # }
137
+ # }
138
+ # Test US Patent and Trademark Office (USPTO) tools (if uspto_downloader_MCP.py is running)
139
+ {
140
+ "name": "mcp_download_abst",
141
+ "arguments": {"query": {"applicationNumberText": "19053071"}},
142
+ },
143
+ {
144
+ "name": "mcp_download_claims",
145
+ "arguments": {"query": {"applicationNumberText": "19053071"}},
146
+ },
147
+ # {
148
+ # "name": "mcp_download_full_text",
149
+ # "arguments": {
150
+ # "query": {"applicationNumberText": "19053071"}
151
+ # }
152
+ # },
153
+ {
154
+ "name": "mcp_download_full_text",
155
+ "arguments": {
156
+ "query": {
157
+ "applicationNumberText": "18837017"
158
+ } # This one should not have a full text document
159
+ },
160
+ },
161
+ # # Test Boltz2 tool (if boltz_mcp_server.py is running)
162
+ # {
163
+ # "name": "mcp_run_boltz2",
164
+ # "arguments": {
165
+ # "query": {
166
+ # "protein_sequence": "MLSRLFRMHGLFVASHPWEVIVGTVTLTICMMSMNMFTGNNKICGWNYECPKFEEDVLSSDIIILTITRCIAILYIYFQFQNLRQLGSKYILGIAGLFTIFSSFVFSTVVIHFLDKELTGLNEALPFFLLLIDLSRASTLAKFALSSNSQDEVRENIARGMAILGPTFTLDALVECLVIGVGTMSGVRQLEIMCCFGCMSVLANYFVFMTFFPACVSLVLELSRESREGRPIWQLSHFARVLEEEENKPNPVTQRVKMIMSLGLVLVHAHSRWIADPSPQNSTADTSKVSLGLDENVSKRIEPSVSLWQFYLSKMISMDIEQVITLSLALLLAVKYIFFEQTETESTLSLKNPITSPVVTQKKVPDNCCRREPMLVRNNQKCDSVEEETGINRERKVEVIKPLVAETDTPNRATFVVGNSSLLDTSSVLVTQEPEIELPREPRPNEECLQILGNAEKGAKFLSDAEIIQLVNAKHIPAYKLETLMETHERGVSIRRQLLSKKLSEPSSLQYLPYRDYNYSLVMGACCENVIGYMPIPVGVAGPLCLDEKEFQVPMATTEGCLVASTNRGCRAIGLGGGASSRVLADGMTRGPVVRLPRACDSAEVKAWLETSEGFAVIKEAFDSTSRFARLQKLHTSIAGRNLYIRFQSRSGDAMGMNMISKGTEKALSKLHEYFPEMQILAVSGNYCTDKKPAAINWIEGRGKSVVCEAVIPAKVVREVLKTTTEAMIEVNINKNLVGSAMAGSIGGYNAHAANIVTAIYIACGQDAAQNVGSSNCITLMEASGPTNEDLYISCTMPSIEIGTVGGGTNLLPQQACLQMLGVQGACKDNPGENARQLARIVCGTVMAGELSLMAALAAGHLVKSHMIHNRSKINLQDLQGACTKKTA",
167
+ # "ligands": [
168
+ # {"id": "L1", "smiles": "CC[C@H](C)C(=O)O[C@H]1C[C@@H](C=C2[C@H]1[C@H]([C@H](C=C2)C)CC[C@H](C[C@H](CC(=O)O)O)O)O"},
169
+ # ],
170
+ # "use_potentials": True,
171
+ # "diffusion_samples": 1,
172
+ # "return_structure": False
173
+ # }
174
+ # }
175
+ # }
176
+ ]
177
+
178
+ # Step 4: Run test queries with error handling
179
+ print(f"\n๐Ÿงช Running {len(test_queries)} MCP tool tests...")
180
+ print("=" * 60)
181
+
182
+ successful_tests = 0
183
+ failed_tests = 0
184
+
185
+ for idx, query in enumerate(test_queries):
186
+ print(f"\n[Test {idx+1}/{len(test_queries)}] {query['name']}")
187
+ print(f"Operation: {query['arguments'].get('operation', 'N/A')}")
188
+
189
+ if "tool_name" in query["arguments"]:
190
+ print(f"Tool: {query['arguments']['tool_name']}")
191
+
192
+ try:
193
+ # Add timeout to prevent hanging
194
+ start_time = time.time()
195
+ result = tooluni.run(query)
196
+ execution_time = time.time() - start_time
197
+
198
+ print(f"โœ… Success in {execution_time:.2f}s")
199
+
200
+ # Format output nicely
201
+ if isinstance(result, dict):
202
+ if "error" in result:
203
+ print(f"โš ๏ธ Tool returned error: {result['error']}")
204
+ else:
205
+ # Show a snippet of the result
206
+ result_str = json.dumps(result, indent=2)
207
+ print(f"๐Ÿ“Š Result: {result_str}")
208
+ else:
209
+ result_str = str(result)
210
+ print(f"๐Ÿ“Š Result: {result_str}")
211
+
212
+ if "error" not in result:
213
+ successful_tests += 1
214
+ else:
215
+ failed_tests += 1
216
+ print(f"โŒ Test failed with error: {result['error']}")
217
+
218
+ except Exception as e:
219
+ print(f"โŒ Failed: {str(e)}")
220
+ failed_tests += 1
221
+
222
+ # Small delay between tests
223
+ time.sleep(0.5)
224
+
225
+ # Step 5: Test Summary
226
+ print("\n" + "=" * 60)
227
+ print("๐ŸŽฏ MCP Tool Test Summary")
228
+ print("=" * 60)
229
+ print(f"โœ… Successful tests: {successful_tests}")
230
+ print(f"โŒ Failed tests: {failed_tests}")
231
+ print(
232
+ f"๐Ÿ“Š Success rate: {(successful_tests/(successful_tests + failed_tests)*100):.1f}%"
233
+ )
234
+
235
+ # if failed_tests > 0:
236
+ # print("\n๐Ÿ’ก Tips for failed tests:")
237
+ # print("- Make sure MCP servers are running (e.g., python fastmcp_official_example.py)")
238
+ # print("- Check server URLs and ports in mcp_client_tools.json")
239
+ # print("- Verify network connectivity to MCP servers")
240
+ # print("- Some tools may require specific arguments or server capabilities")
241
+
242
+ # print("\n๐Ÿ”ง Available MCP tools in ToolUniverse:")
243
+ # for tool_name in mcp_tools:
244
+ # tool_config = tooluni.all_tool_dict.get(tool_name, {})
245
+ # print(f" - {tool_name}: {tool_config.get('description', 'No description')}")
246
+
247
+ print("\nโœจ MCP integration test completed!")