tooluniverse 1.0.3__py3-none-any.whl → 1.0.5__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 (32) hide show
  1. tooluniverse/__init__.py +17 -5
  2. tooluniverse/agentic_tool.py +268 -330
  3. tooluniverse/compose_scripts/output_summarizer.py +21 -15
  4. tooluniverse/data/agentic_tools.json +2 -2
  5. tooluniverse/data/odphp_tools.json +354 -0
  6. tooluniverse/data/output_summarization_tools.json +2 -2
  7. tooluniverse/default_config.py +1 -0
  8. tooluniverse/llm_clients.py +570 -0
  9. tooluniverse/mcp_tool_registry.py +3 -3
  10. tooluniverse/odphp_tool.py +226 -0
  11. tooluniverse/output_hook.py +92 -3
  12. tooluniverse/remote/boltz/boltz_mcp_server.py +2 -2
  13. tooluniverse/remote/uspto_downloader/uspto_downloader_mcp_server.py +2 -2
  14. tooluniverse/smcp.py +204 -112
  15. tooluniverse/smcp_server.py +23 -20
  16. tooluniverse/test/list_azure_openai_models.py +210 -0
  17. tooluniverse/test/test_agentic_tool_azure_models.py +91 -0
  18. tooluniverse/test/test_api_key_validation_min.py +64 -0
  19. tooluniverse/test/test_claude_sdk.py +86 -0
  20. tooluniverse/test/test_global_fallback.py +288 -0
  21. tooluniverse/test/test_hooks_direct.py +219 -0
  22. tooluniverse/test/test_odphp_tool.py +166 -0
  23. tooluniverse/test/test_openrouter_client.py +288 -0
  24. tooluniverse/test/test_stdio_hooks.py +285 -0
  25. tooluniverse/test/test_tool_finder.py +1 -1
  26. {tooluniverse-1.0.3.dist-info → tooluniverse-1.0.5.dist-info}/METADATA +101 -74
  27. {tooluniverse-1.0.3.dist-info → tooluniverse-1.0.5.dist-info}/RECORD +31 -19
  28. tooluniverse-1.0.5.dist-info/licenses/LICENSE +201 -0
  29. tooluniverse-1.0.3.dist-info/licenses/LICENSE +0 -21
  30. {tooluniverse-1.0.3.dist-info → tooluniverse-1.0.5.dist-info}/WHEEL +0 -0
  31. {tooluniverse-1.0.3.dist-info → tooluniverse-1.0.5.dist-info}/entry_points.txt +0 -0
  32. {tooluniverse-1.0.3.dist-info → tooluniverse-1.0.5.dist-info}/top_level.txt +0 -0
@@ -81,31 +81,37 @@ def compose(arguments: Dict[str, Any], tooluniverse, call_tool) -> Dict[str, Any
81
81
  else:
82
82
  print(f"❌ Chunk {i+1} summarization failed")
83
83
 
84
- # Step 3: Merge summaries
84
+ # Step 3: Merge summaries (or gracefully fall back)
85
85
  if chunk_summaries:
86
86
  final_summary = _merge_summaries(
87
87
  chunk_summaries, query_context, tool_name, max_summary_length, call_tool
88
88
  )
89
+ print(
90
+ f"✅ Summarization completed. Final length: {len(final_summary)} characters"
91
+ )
92
+ return {
93
+ "success": True,
94
+ "original_length": len(tool_output),
95
+ "summary_length": len(final_summary),
96
+ "chunks_processed": len(chunks),
97
+ "summary": final_summary,
98
+ "tool_name": tool_name,
99
+ }
89
100
  else:
90
- final_summary = "Unable to generate summary due to processing errors."
101
+ # Treat as a non-fatal failure so upstream falls back to original output
91
102
  print("❌ No chunk summaries were generated. This usually indicates:")
92
103
  print(" 1. ToolOutputSummarizer tool is not available")
93
104
  print(" 2. The output_summarization tools are not loaded")
94
105
  print(" 3. There was an error in the summarization process")
95
106
  print(" Please check that the SMCP server is started with hooks enabled.")
96
-
97
- print(
98
- f" Summarization completed. Final length: {len(final_summary)} characters"
99
- )
100
-
101
- return {
102
- "success": True,
103
- "original_length": len(tool_output),
104
- "summary_length": len(final_summary),
105
- "chunks_processed": len(chunks),
106
- "summary": final_summary,
107
- "tool_name": tool_name,
108
- }
107
+ return {
108
+ "success": False,
109
+ "error": "No chunk summaries generated",
110
+ "original_length": len(tool_output),
111
+ "chunks_processed": len(chunks),
112
+ "original_output": tool_output,
113
+ "tool_name": tool_name,
114
+ }
109
115
 
110
116
  except Exception as e:
111
117
  error_msg = f"Error in output summarization: {str(e)}"
@@ -1162,7 +1162,7 @@
1162
1162
  "type": "AgenticTool",
1163
1163
  "name": "ToolMetadataGenerator",
1164
1164
  "description": "Generates a JSON structure with the metadata of a tool in ToolUniverse, given the JSON configuration of the tool.",
1165
- "prompt": "You are an expert in processing ToolUniverse tool configurations. Your task is to extract and generate key metadata from a given tool's JSON configuration and return it as a new, structured JSON object.\n\n**Input Tool Configuration:**\n```json\n{tool_config}\n```\n\n**Tool Type Mappings (for simplifying toolType):**\n```json\n{tool_type_mappings}\n```\n\n**Instructions:**\nFrom the input configuration, generate a new JSON object with the specified structure. All fields enclosed in '<','>' are placeholders for instructions; you should generate a specific value for the tool based on its configuration. Fields not in brackets should use the default values provided.\n\n**Output JSON Structure:**\n```json\n{\n \"id\": \"<generate a new uuid>\",\n \"name\": \"<extract from tool_config.name>\",\n \"description\": \"<extract and tool_config.description and slightly summarize it if it is too long>\",\n \"detailed_description\": \"<extract from tool_config.description>\",\n \"toolType\": \"<if tool_config.type or tool_config.name appears in tool_type_mappings dict in one of the lists (among the dict's values), extract the corresponding key and set it as the simplified toolType. otherwise, set toolType to be 'API' (the default)>\",\n \"tags\": [],\n \"category\": \"<extract from tool_config.type>\",\n \"lab\": \"Zitnik Lab\",\n \"source\": \"<extract the name of the database, package, model, or write 'Agentic'>\",\n \"version\": \"v1.0.0\",\n \"reviewed\": true,\n \"isValidated\": true,\n \"usageStats\": \"100+ uses\",\n \"capabilities\": [\n \"<list capabilities strictly derivable from tool_config>\"\n ],\n \"limitations\": [\n \"None for now\"\n ],\n \"parameters\": {<for each parameter key include an object with type and description>},\n \"inputSchema\": <echo tool_config.parameter exactly>,\n \"exampleInput\": <JSON object with example values for each parameter>,\n \"apiEndpoints\": [\n {\n \"method\": \"MCP\",\n \"url\": \"https://tooluniversemcpserver.onrender.com/mcp/\"\n }\n ]\n}\n```\n\nReturn ONLY the final JSON object with no extra commentary.",
1165
+ "prompt": "You are an expert in processing ToolUniverse tool configurations. Your task is to extract and generate key metadata from a given tool's JSON configuration and return it as a new, structured JSON object.\n\n**Input Tool Configuration:**\n```json\n{tool_config}\n```\n\n**Tool Type Mappings (for simplifying toolType):**\n```json\n{tool_type_mappings}\n```\n\n**Instructions:**\nFrom the input configuration, generate a new JSON object with the specified structure. All fields enclosed in '<','>' are placeholders for instructions; you should generate a specific value for the tool based on its configuration. Fields not in brackets should use the default values provided.\n\n**Output JSON Structure:**\n```json\n{\n \"id\": \"<generate a new uuid>\",\n \"name\": \"<extract from tool_config.name>\",\n \"description\": \"<extract and tool_config.description and slightly summarize it if it is too long>\",\n \"detailed_description\": \"<extract from tool_config.description>\",\n \"toolType\": \"<if tool_config.type or tool_config.name appears in tool_type_mappings dict in one of the lists (among the dict's values), extract the corresponding key and set it as the simplified toolType. otherwise, set toolType to be 'API' (the default)>\",\n \"tags\": [],\n \"category\": \"<extract from tool_config.type>\",\n \"lab\": \"Zitnik Lab\",\n \"source\": \"<extract the name of the database, package, model, or write 'Agentic'>\",\n \"version\": \"v1.0.0\",\n \"reviewed\": true,\n \"isValidated\": true,\n \"usageStats\": \"100+ uses\",\n \"capabilities\": [\n \"<list capabilities strictly derivable from tool_config>\"\n ],\n \"limitations\": [\n \"None for now\"\n ],\n \"parameters\": {<for each parameter key include an object with type and description>},\n \"inputSchema\": <echo tool_config.parameter exactly>,\n \"exampleInput\": {},\n \"apiEndpoints\": [\n {\n \"method\": \"MCP\",\n \"url\": \"https://tooluniversemcpserver.onrender.com/mcp/\"\n }\n ]\n}\n```\n\nReturn ONLY the final JSON object with no extra commentary.",
1166
1166
  "input_arguments": [
1167
1167
  "tool_config",
1168
1168
  "tool_type_mappings"
@@ -1268,4 +1268,4 @@
1268
1268
  "return_json": true
1269
1269
  }
1270
1270
  }
1271
- ]
1271
+ ]
@@ -0,0 +1,354 @@
1
+ [
2
+ {
3
+ "name": "odphp_myhealthfinder",
4
+ "description": "This tool provides personalized preventive-care recommendations and it is helpful for different ages, sexes, pregnancy status, gives age/sex/pregnancy. It retrieves metadata, plain-language sections, and dataset links to the full article (AccessibleVersion links). If the user wants the full text of a recommendation, the `odphp_outlink_fetch` tool is helpful.",
5
+ "type": "ODPHPMyHealthfinder",
6
+ "parameter": {
7
+ "type": "object",
8
+ "properties": {
9
+ "lang": { "type": "string", "description": "Language code (en or es)" },
10
+ "age": { "type": "integer", "description": "Age in years (0–120)" },
11
+ "sex": { "type": "string", "description": "Male or Female" },
12
+ "pregnant": { "type": "string", "description": "\"Yes\" or \"No\"" },
13
+ "strip_html": { "type": "boolean", "description": "If true, also return PlainSections[] with HTML removed for each topic" }
14
+ }
15
+ },
16
+ "fields": { "endpoint": "/myhealthfinder.json", "return_format": "JSON" },
17
+ "return_schema": {
18
+ "type": "object",
19
+ "properties": {
20
+ "Error": { "type": "string" },
21
+ "Total": { "type": "integer" },
22
+ "Query": { "type": "object" },
23
+ "Language": { "type": "string" },
24
+ "MyHFHeading": { "type": "string" },
25
+ "TakeAction": { "type": "string" },
26
+ "AboutTheseResults": { "type": "string" },
27
+ "Resources": {
28
+ "type": "object",
29
+ "properties": {
30
+ "All": {
31
+ "type": "object",
32
+ "properties": {
33
+ "Resource": {
34
+ "type": "array",
35
+ "items": {
36
+ "type": "object",
37
+ "properties": {
38
+ "Type": { "type": "string" },
39
+ "Id": { "type": "string" },
40
+ "Title": { "type": "string" },
41
+ "TranslationId": { "type": "string" },
42
+ "TranslationTitle": { "type": "string" },
43
+ "Categories": { "type": "string" },
44
+ "MyHFTitle": { "type": "string" },
45
+ "MyHFCategory": { "type": "string" },
46
+ "MyHFCategoryHeading": { "type": "string" },
47
+ "LastUpdate": { "type": "string" },
48
+ "ImageUrl": { "type": "string" },
49
+ "ImageAlt": { "type": "string" },
50
+ "AccessibleVersion": { "type": "string" },
51
+ "RelatedItems": {
52
+ "type": "object",
53
+ "properties": {
54
+ "RelatedItem": {
55
+ "type": "array",
56
+ "items": {
57
+ "type": "object",
58
+ "properties": {
59
+ "Type": { "type": "string" },
60
+ "Id": { "type": "string" },
61
+ "Title": { "type": "string" },
62
+ "Url": { "type": "string" }
63
+ }
64
+ }
65
+ }
66
+ }
67
+ },
68
+ "Sections": {
69
+ "type": "object",
70
+ "properties": {
71
+ "Section": {
72
+ "type": "array",
73
+ "items": {
74
+ "type": "object",
75
+ "properties": {
76
+ "Title": { "type": "string" },
77
+ "Content": { "type": "string" }
78
+ }
79
+ }
80
+ },
81
+ "section": {
82
+ "type": "array",
83
+ "items": {
84
+ "type": "object",
85
+ "properties": {
86
+ "Title": { "type": "string" },
87
+ "Content": { "type": "string" }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ },
93
+ "HealthfinderLogo": { "type": "string" },
94
+ "HealthfinderUrl": { "type": "string" }
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+ }
101
+ },
102
+ "Callouts": {
103
+ "type": "object",
104
+ "properties": {
105
+ "All": {
106
+ "type": "object",
107
+ "properties": {
108
+ "Resource": {
109
+ "type": "array",
110
+ "items": {
111
+ "type": "object",
112
+ "properties": {
113
+ "Type": { "type": "string" },
114
+ "Id": { "type": "string" },
115
+ "Title": { "type": "string" },
116
+ "TranslationId": { "type": "string" },
117
+ "TranslationTitle": { "type": "string" },
118
+ "Categories": { "type": "string" },
119
+ "MyHFTitle": { "type": "string" },
120
+ "MyHFCategory": { "type": "string" },
121
+ "MyHFCategoryHeading": { "type": "string" },
122
+ "LastUpdate": { "type": "string" },
123
+ "ImageUrl": { "type": "string" },
124
+ "ImageAlt": { "type": "string" },
125
+ "AccessibleVersion": { "type": "string" },
126
+ "RelatedItems": {
127
+ "type": "object",
128
+ "properties": {
129
+ "RelatedItem": {
130
+ "type": "array",
131
+ "items": {
132
+ "type": "object",
133
+ "properties": {
134
+ "Type": { "type": "string" },
135
+ "Id": { "type": "string" },
136
+ "Title": { "type": "string" },
137
+ "Url": { "type": "string" }
138
+ }
139
+ }
140
+ }
141
+ }
142
+ },
143
+ "Sections": {
144
+ "type": "object",
145
+ "properties": {
146
+ "Section": {
147
+ "type": "array",
148
+ "items": {
149
+ "type": "object",
150
+ "properties": {
151
+ "Title": { "type": "string" },
152
+ "Content": { "type": "string" }
153
+ }
154
+ }
155
+ },
156
+ "section": {
157
+ "type": "array",
158
+ "items": {
159
+ "type": "object",
160
+ "properties": {
161
+ "Title": { "type": "string" },
162
+ "Content": { "type": "string" }
163
+ }
164
+ }
165
+ }
166
+ }
167
+ },
168
+ "HealthfinderLogo": { "type": "string" },
169
+ "HealthfinderUrl": { "type": "string" }
170
+ }
171
+ }
172
+ }
173
+ }
174
+ }
175
+ }
176
+ }
177
+ }
178
+ }
179
+ },
180
+ {
181
+ "name": "odphp_itemlist",
182
+ "description": "This tools browses and returns available topics and categories and it is helpful to help narrow a broad request (e.g., “show me all topics”). For full topic content, `odphp_topicsearch` tool is helpful.",
183
+ "type": "ODPHPItemList",
184
+ "parameter": {
185
+ "type": "object",
186
+ "properties": {
187
+ "lang": { "type": "string", "description": "Language code (en or es)" },
188
+ "type": { "type": "string", "description": "topic or category" }
189
+ }
190
+ },
191
+ "fields": { "endpoint": "/itemlist.json", "return_format": "JSON" },
192
+ "return_schema": {
193
+ "type": "object",
194
+ "properties": {
195
+ "Error": { "type": "string" },
196
+ "Total": { "type": "integer" },
197
+ "Query": { "type": "object" },
198
+ "Language": { "type": "string" },
199
+ "Items": {
200
+ "type": "object",
201
+ "properties": {
202
+ "Item": {
203
+ "type": "array",
204
+ "items": {
205
+ "type": "object",
206
+ "properties": {
207
+ "Type": { "type": "string" },
208
+ "Id": { "type": "string" },
209
+ "Title": { "type": "string" },
210
+ "ParentId": { "type": "string" },
211
+ "TranslationId": { "type": "string" }
212
+ }
213
+ }
214
+ }
215
+ }
216
+ }
217
+ }
218
+ }
219
+ },
220
+ {
221
+ "name": "odphp_topicsearch",
222
+ "description": "Find specific health topics and get their full content. Use when the user mentions a keyword (e.g., “folic acid”, “blood pressure”) or when you already have topic/category IDs from `odphp_itemlist`. Returns detailed topic pages (Title, Sections, RelatedItems) and an AccessibleVersion link. Next: to quote or summarize the actual page text, pass the AccessibleVersion (or RelatedItems URLs) to `odphp_outlink_fetch`.",
223
+ "type": "ODPHPTopicSearch",
224
+ "parameter": {
225
+ "type": "object",
226
+ "properties": {
227
+ "lang": { "type": "string", "description": "Language code (en or es)" },
228
+ "topicId": { "type": "string", "description": "Comma-separated topic IDs" },
229
+ "categoryId": { "type": "string", "description": "Comma-separated category IDs" },
230
+ "keyword": { "type": "string", "description": "Keyword search for topics" },
231
+ "strip_html": { "type": "boolean", "description": "If true, also return PlainSections[] with HTML removed for each topic" }
232
+ }
233
+ },
234
+ "fields": { "endpoint": "/topicsearch.json", "return_format": "JSON" },
235
+ "return_schema": {
236
+ "type": "object",
237
+ "properties": {
238
+ "Error": { "type": "string" },
239
+ "Total": { "type": "integer" },
240
+ "Query": { "type": "object" },
241
+ "Language": { "type": "string" },
242
+ "Resources": {
243
+ "type": "object",
244
+ "properties": {
245
+ "Resource": {
246
+ "type": "array",
247
+ "items": {
248
+ "type": "object",
249
+ "properties": {
250
+ "Type": { "type": "string" },
251
+ "Id": { "type": "string" },
252
+ "Title": { "type": "string" },
253
+ "TranslationId": { "type": "string" },
254
+ "TranslationTitle": { "type": "string" },
255
+ "Categories": { "type": "string" },
256
+ "MyHFTitle": { "type": "string" },
257
+ "MyHFCategory": { "type": "string" },
258
+ "MyHFCategoryHeading": { "type": "string" },
259
+ "LastUpdate": { "type": "string" },
260
+ "ImageUrl": { "type": "string" },
261
+ "ImageAlt": { "type": "string" },
262
+ "AccessibleVersion": { "type": "string" },
263
+ "RelatedItems": {
264
+ "type": "object",
265
+ "properties": {
266
+ "RelatedItem": {
267
+ "type": "array",
268
+ "items": {
269
+ "type": "object",
270
+ "properties": {
271
+ "Type": { "type": "string" },
272
+ "Id": { "type": "string" },
273
+ "Title": { "type": "string" },
274
+ "Url": { "type": "string" }
275
+ }
276
+ }
277
+ }
278
+ }
279
+ },
280
+ "Sections": {
281
+ "type": "object",
282
+ "properties": {
283
+ "Section": {
284
+ "type": "array",
285
+ "items": {
286
+ "type": "object",
287
+ "properties": {
288
+ "Title": { "type": "string" },
289
+ "Content": { "type": "string" }
290
+ }
291
+ }
292
+ },
293
+ "section": {
294
+ "type": "array",
295
+ "items": {
296
+ "type": "object",
297
+ "properties": {
298
+ "Title": { "type": "string" },
299
+ "Content": { "type": "string" }
300
+ }
301
+ }
302
+ }
303
+ }
304
+ },
305
+ "HealthfinderLogo": { "type": "string" },
306
+ "HealthfinderUrl": { "type": "string" }
307
+ }
308
+ }
309
+ }
310
+ }
311
+ }
312
+ }
313
+ }
314
+ },
315
+ {
316
+ "name": "odphp_outlink_fetch",
317
+ "description": "This tool retrieves readable text from ODPHP article links and information sources. This is helpful after using the `odphp_myhealthfinder` or `odphp_topicsearch` tools or when the user wants to simply dive deeper into ODPHP data.",
318
+ "type": "ODPHPOutlinkFetch",
319
+ "parameter": {
320
+ "type": "object",
321
+ "properties": {
322
+ "urls": {
323
+ "type": "array",
324
+ "items": { "type": "string" },
325
+ "description": "1–3 absolute URLs from AccessibleVersion or RelatedItems.Url"
326
+ },
327
+ "max_chars": { "type": "integer", "description": "Optional hard cap on extracted text length (e.g., 5000)" },
328
+ "return_html": { "type": "boolean", "description": "If true, also return minimally cleaned HTML" }
329
+ },
330
+ "required": ["urls"]
331
+ },
332
+ "fields": { "endpoint": "/outlink", "return_format": "JSON" },
333
+ "return_schema": {
334
+ "type": "object",
335
+ "properties": {
336
+ "results": {
337
+ "type": "array",
338
+ "items": {
339
+ "type": "object",
340
+ "properties": {
341
+ "url": { "type": "string" },
342
+ "status": { "type": "integer" },
343
+ "content_type": { "type": "string" },
344
+ "title": { "type": "string" },
345
+ "text": { "type": "string" },
346
+ "html": { "type": "string" }
347
+ }
348
+ }
349
+ },
350
+ "metadata": { "type": "object" }
351
+ }
352
+ }
353
+ }
354
+ ]
@@ -73,7 +73,7 @@
73
73
  "type": "integer",
74
74
  "description": "Size of each chunk for processing",
75
75
  "required": false,
76
- "default": 2000
76
+ "default": 30000
77
77
  },
78
78
  "focus_areas": {
79
79
  "type": "string",
@@ -85,7 +85,7 @@
85
85
  "type": "integer",
86
86
  "description": "Maximum length of final summary",
87
87
  "required": false,
88
- "default": 3000
88
+ "default": 10000
89
89
  }
90
90
  },
91
91
  "required": ["tool_output", "query_context", "tool_name"]
@@ -113,6 +113,7 @@ default_tool_files = {
113
113
  "output_summarization": os.path.join(
114
114
  current_dir, "data", "output_summarization_tools.json"
115
115
  ),
116
+ "odphp": os.path.join(current_dir, "data", "odphp_tools.json"),
116
117
  }
117
118
 
118
119