chuk-tool-processor 0.6.24__py3-none-any.whl → 0.6.25__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 chuk-tool-processor might be problematic. Click here for more details.

@@ -250,11 +250,13 @@ class ToolProcessor:
250
250
 
251
251
  # Execute tool calls
252
252
  async with log_context_span("tool_execution", {"num_calls": len(calls)}):
253
- # Check if any tools are unknown
253
+ # Check if any tools are unknown - search across all namespaces
254
254
  unknown_tools = []
255
+ all_tools = await self.registry.list_tools() # Returns list of (namespace, name) tuples
256
+ tool_names_in_registry = {name for ns, name in all_tools}
257
+
255
258
  for call in calls:
256
- tool = await self.registry.get_tool(call.tool)
257
- if not tool:
259
+ if call.tool not in tool_names_in_registry:
258
260
  unknown_tools.append(call.tool)
259
261
 
260
262
  if unknown_tools:
@@ -45,7 +45,7 @@ class MetricsLogger:
45
45
  cached: Whether the result was retrieved from cache
46
46
  attempts: Number of execution attempts
47
47
  """
48
- self.logger.info(
48
+ self.logger.debug(
49
49
  f"Tool execution metric: {tool}",
50
50
  extra={
51
51
  "context": {
@@ -76,7 +76,7 @@ class MetricsLogger:
76
76
  duration: Parsing duration in seconds
77
77
  num_calls: Number of tool calls parsed
78
78
  """
79
- self.logger.info(
79
+ self.logger.debug(
80
80
  f"Parser metric: {parser}",
81
81
  extra={
82
82
  "context": {
@@ -389,9 +389,40 @@ class StdioTransport(MCPBaseTransport):
389
389
  try:
390
390
  response = await asyncio.wait_for(send_tools_list(*self._streams), timeout=self.default_timeout)
391
391
 
392
- # Normalize response
393
- if isinstance(response, dict):
394
- tools = response.get("tools", [])
392
+ # Normalize response - handle multiple formats including Pydantic models
393
+ # 1. Check if it's a Pydantic model with tools attribute (e.g., ListToolsResult from chuk_mcp)
394
+ if hasattr(response, "tools"):
395
+ tools = response.tools
396
+ # Convert Pydantic Tool models to dicts if needed
397
+ if tools and len(tools) > 0 and hasattr(tools[0], "model_dump"):
398
+ tools = [tool.model_dump() if hasattr(tool, "model_dump") else tool for tool in tools]
399
+ elif tools and len(tools) > 0 and hasattr(tools[0], "dict"):
400
+ # Older Pydantic versions use dict() instead of model_dump()
401
+ tools = [tool.dict() if hasattr(tool, "dict") else tool for tool in tools]
402
+ # 2. Check if it's a Pydantic model that can be dumped
403
+ elif hasattr(response, "model_dump"):
404
+ dumped = response.model_dump()
405
+ tools = dumped.get("tools", [])
406
+ # 3. Handle dict responses
407
+ elif isinstance(response, dict):
408
+ # Check for tools at top level
409
+ if "tools" in response:
410
+ tools = response["tools"]
411
+ # Check for nested result.tools (common in some MCP implementations)
412
+ elif "result" in response and isinstance(response["result"], dict):
413
+ tools = response["result"].get("tools", [])
414
+ # Check if response itself is the result with MCP structure
415
+ elif "jsonrpc" in response and "result" in response:
416
+ result = response["result"]
417
+ if isinstance(result, dict):
418
+ tools = result.get("tools", [])
419
+ elif isinstance(result, list):
420
+ tools = result
421
+ else:
422
+ tools = []
423
+ else:
424
+ tools = []
425
+ # 4. Handle list responses
395
426
  elif isinstance(response, list):
396
427
  tools = response
397
428
  else:
@@ -443,7 +474,7 @@ class StdioTransport(MCPBaseTransport):
443
474
  return {"isError": True, "error": "Failed to recover connection"}
444
475
 
445
476
  response = await asyncio.wait_for(
446
- send_tools_call(*self._streams, tool_name, arguments), timeout=tool_timeout
477
+ send_tools_call(*self._streams, tool_name, arguments, timeout=tool_timeout), timeout=tool_timeout
447
478
  )
448
479
 
449
480
  response_time = time.time() - start_time
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chuk-tool-processor
3
- Version: 0.6.24
3
+ Version: 0.6.25
4
4
  Summary: Async-native framework for registering, discovering, and executing tools referenced in LLM responses
5
5
  Author-email: CHUK Team <chrishayuk@somejunkmailbox.com>
6
6
  Maintainer-email: CHUK Team <chrishayuk@somejunkmailbox.com>
@@ -1,7 +1,7 @@
1
1
  chuk_tool_processor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  chuk_tool_processor/core/__init__.py,sha256=O4uwbEQN6G6sGrKKQNHRW-99ROlPEVct7wOSzVoazXQ,39
3
3
  chuk_tool_processor/core/exceptions.py,sha256=s35RVMIt8PQGP10ZS7L7sS0Pddpj0kc3Ut3wISDYn_U,1559
4
- chuk_tool_processor/core/processor.py,sha256=G4D8YJi_JDwwS05AuejCe_Fg0kapcdLj-2iff-aYb7U,17650
4
+ chuk_tool_processor/core/processor.py,sha256=1pv76USunPXGIfeDs-wj2amdKvBBrBgkjgI2_JOK6vU,17825
5
5
  chuk_tool_processor/execution/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  chuk_tool_processor/execution/tool_executor.py,sha256=zVQbNS9qUNn-1J1BPaFMGptKVFt0tXxh2bKiK-o1P2E,13705
7
7
  chuk_tool_processor/execution/strategies/__init__.py,sha256=fkHvK2Ca6c4npcpmS5aYHrdqYrgFm7DYdor-t-yCwuc,286
@@ -15,7 +15,7 @@ chuk_tool_processor/logging/__init__.py,sha256=baLu0gYVB4Ni4V-IyERk-vB83caqezsFi
15
15
  chuk_tool_processor/logging/context.py,sha256=DzDPOiDny5I7J4ihsa1mV-tHKw4xn7UbeTG9UD6sKGc,12174
16
16
  chuk_tool_processor/logging/formatter.py,sha256=gxbkfR-J-ksRiNfxUijVm4iHUd6OAau-8Z_Kemz552c,2893
17
17
  chuk_tool_processor/logging/helpers.py,sha256=207AXMHGlw6kq1cFiwLOJRGYgzuuKvTWn94aCJvZZXs,5751
18
- chuk_tool_processor/logging/metrics.py,sha256=6nIEE2-7UOtMlWS-BQv2ILB2XilLeih8MSuMbXHdYYA,3522
18
+ chuk_tool_processor/logging/metrics.py,sha256=8LRHjgkfdcQnh4H7AP2FJDfcRO3q1UpsBSwoHiuUqXY,3524
19
19
  chuk_tool_processor/mcp/__init__.py,sha256=xqtoSGX1_5jZDJ6AKJpBByaytS22baDOrhzFiecvVSs,1031
20
20
  chuk_tool_processor/mcp/mcp_tool.py,sha256=zOx3YeuKyuFK-PbUt3gqdq_q8VRrHFD6sgma6qKbfPY,19170
21
21
  chuk_tool_processor/mcp/register_mcp_tools.py,sha256=OyHczwVnqhvBZO9g4I0T56EPMvFYBOl0Y2ivNPdKjCE,4822
@@ -27,7 +27,7 @@ chuk_tool_processor/mcp/transport/__init__.py,sha256=Gpw9QZctxfO-tWZ8URpyFU8rePc
27
27
  chuk_tool_processor/mcp/transport/base_transport.py,sha256=rG61TlaignbVZbsqdBS38TnFzTVO666ehKEI0IUAJCM,8675
28
28
  chuk_tool_processor/mcp/transport/http_streamable_transport.py,sha256=00-kGM3Ie-fdi8VdIE-_YFsKP9_O8lEz9rGtPrR-Vy4,23619
29
29
  chuk_tool_processor/mcp/transport/sse_transport.py,sha256=gjtDe7KHnJMECITqjxfUhg3nVBuUFZhZv-k77gRiUsE,27399
30
- chuk_tool_processor/mcp/transport/stdio_transport.py,sha256=1PvkCGejCHHM0_1-APkDT1npdih7d758FGttgDax2Ds,27678
30
+ chuk_tool_processor/mcp/transport/stdio_transport.py,sha256=bDh3eqe9BnPvcmG7F4BWqGjGO3e8q0lwcZeswx_jK0U,29558
31
31
  chuk_tool_processor/models/__init__.py,sha256=A3ysSvRxaxso_AN57QZt5ZYahJH5zlL-IENqNaius84,41
32
32
  chuk_tool_processor/models/execution_strategy.py,sha256=O0h8d8JSgm-tv26Cc5jAkZqup8vIgx0zfb5n0b2vpSk,1967
33
33
  chuk_tool_processor/models/streaming_tool.py,sha256=3IXe9VV6sgPHzMeHpuNzZThFhu5BuB3MQdoYSogz348,3359
@@ -54,7 +54,7 @@ chuk_tool_processor/registry/providers/__init__.py,sha256=iGc_2JzlYJSBRQ6tFbX781
54
54
  chuk_tool_processor/registry/providers/memory.py,sha256=udfboAHH0gRxtnf3GsI3wMshhobJxYnCkMwKjQ_uqkw,5017
55
55
  chuk_tool_processor/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
56
  chuk_tool_processor/utils/validation.py,sha256=jHPO65sB61ynm9P6V3th4pN7j4u0SQhYR-bstj5QjnI,4175
57
- chuk_tool_processor-0.6.24.dist-info/METADATA,sha256=L15JN0q5Cxps76jaZCT4Bks4WtwYrsNwCeVzyybGqE8,36881
58
- chuk_tool_processor-0.6.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
59
- chuk_tool_processor-0.6.24.dist-info/top_level.txt,sha256=7lTsnuRx4cOW4U2sNJWNxl4ZTt_J1ndkjTbj3pHPY5M,20
60
- chuk_tool_processor-0.6.24.dist-info/RECORD,,
57
+ chuk_tool_processor-0.6.25.dist-info/METADATA,sha256=p0Up04jiimvOqYutjykDUoj7gviM6vSmA6SixQGdWTw,36881
58
+ chuk_tool_processor-0.6.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
59
+ chuk_tool_processor-0.6.25.dist-info/top_level.txt,sha256=7lTsnuRx4cOW4U2sNJWNxl4ZTt_J1ndkjTbj3pHPY5M,20
60
+ chuk_tool_processor-0.6.25.dist-info/RECORD,,