chuk-tool-processor 0.6.12__py3-none-any.whl → 0.6.14__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.

Files changed (56) hide show
  1. chuk_tool_processor/core/__init__.py +1 -1
  2. chuk_tool_processor/core/exceptions.py +10 -4
  3. chuk_tool_processor/core/processor.py +97 -97
  4. chuk_tool_processor/execution/strategies/inprocess_strategy.py +142 -150
  5. chuk_tool_processor/execution/strategies/subprocess_strategy.py +200 -205
  6. chuk_tool_processor/execution/tool_executor.py +82 -84
  7. chuk_tool_processor/execution/wrappers/caching.py +102 -103
  8. chuk_tool_processor/execution/wrappers/rate_limiting.py +45 -42
  9. chuk_tool_processor/execution/wrappers/retry.py +23 -25
  10. chuk_tool_processor/logging/__init__.py +23 -17
  11. chuk_tool_processor/logging/context.py +40 -45
  12. chuk_tool_processor/logging/formatter.py +22 -21
  13. chuk_tool_processor/logging/helpers.py +24 -38
  14. chuk_tool_processor/logging/metrics.py +11 -13
  15. chuk_tool_processor/mcp/__init__.py +8 -12
  16. chuk_tool_processor/mcp/mcp_tool.py +124 -112
  17. chuk_tool_processor/mcp/register_mcp_tools.py +17 -17
  18. chuk_tool_processor/mcp/setup_mcp_http_streamable.py +11 -13
  19. chuk_tool_processor/mcp/setup_mcp_sse.py +11 -13
  20. chuk_tool_processor/mcp/setup_mcp_stdio.py +7 -9
  21. chuk_tool_processor/mcp/stream_manager.py +168 -204
  22. chuk_tool_processor/mcp/transport/__init__.py +4 -4
  23. chuk_tool_processor/mcp/transport/base_transport.py +43 -58
  24. chuk_tool_processor/mcp/transport/http_streamable_transport.py +145 -163
  25. chuk_tool_processor/mcp/transport/sse_transport.py +217 -255
  26. chuk_tool_processor/mcp/transport/stdio_transport.py +188 -190
  27. chuk_tool_processor/models/__init__.py +1 -1
  28. chuk_tool_processor/models/execution_strategy.py +16 -21
  29. chuk_tool_processor/models/streaming_tool.py +28 -25
  30. chuk_tool_processor/models/tool_call.py +19 -34
  31. chuk_tool_processor/models/tool_export_mixin.py +22 -8
  32. chuk_tool_processor/models/tool_result.py +40 -77
  33. chuk_tool_processor/models/validated_tool.py +14 -16
  34. chuk_tool_processor/plugins/__init__.py +1 -1
  35. chuk_tool_processor/plugins/discovery.py +10 -10
  36. chuk_tool_processor/plugins/parsers/__init__.py +1 -1
  37. chuk_tool_processor/plugins/parsers/base.py +1 -2
  38. chuk_tool_processor/plugins/parsers/function_call_tool.py +13 -8
  39. chuk_tool_processor/plugins/parsers/json_tool.py +4 -3
  40. chuk_tool_processor/plugins/parsers/openai_tool.py +12 -7
  41. chuk_tool_processor/plugins/parsers/xml_tool.py +4 -4
  42. chuk_tool_processor/registry/__init__.py +12 -12
  43. chuk_tool_processor/registry/auto_register.py +22 -30
  44. chuk_tool_processor/registry/decorators.py +127 -129
  45. chuk_tool_processor/registry/interface.py +26 -23
  46. chuk_tool_processor/registry/metadata.py +27 -22
  47. chuk_tool_processor/registry/provider.py +17 -18
  48. chuk_tool_processor/registry/providers/__init__.py +16 -19
  49. chuk_tool_processor/registry/providers/memory.py +18 -25
  50. chuk_tool_processor/registry/tool_export.py +42 -51
  51. chuk_tool_processor/utils/validation.py +15 -16
  52. {chuk_tool_processor-0.6.12.dist-info → chuk_tool_processor-0.6.14.dist-info}/METADATA +1 -1
  53. chuk_tool_processor-0.6.14.dist-info/RECORD +60 -0
  54. chuk_tool_processor-0.6.12.dist-info/RECORD +0 -60
  55. {chuk_tool_processor-0.6.12.dist-info → chuk_tool_processor-0.6.14.dist-info}/WHEEL +0 -0
  56. {chuk_tool_processor-0.6.12.dist-info → chuk_tool_processor-0.6.14.dist-info}/top_level.txt +0 -0
@@ -17,8 +17,6 @@ It:
17
17
 
18
18
  from __future__ import annotations
19
19
 
20
- from typing import Dict, List, Optional, Tuple
21
-
22
20
  from chuk_tool_processor.core.processor import ToolProcessor
23
21
  from chuk_tool_processor.logging import get_logger
24
22
  from chuk_tool_processor.mcp.register_mcp_tools import register_mcp_tools
@@ -32,29 +30,29 @@ logger = get_logger("chuk_tool_processor.mcp.setup_http_streamable")
32
30
  # --------------------------------------------------------------------------- #
33
31
  async def setup_mcp_http_streamable(
34
32
  *,
35
- servers: List[Dict[str, str]],
36
- server_names: Optional[Dict[int, str]] = None,
33
+ servers: list[dict[str, str]],
34
+ server_names: dict[int, str] | None = None,
37
35
  connection_timeout: float = 30.0,
38
36
  default_timeout: float = 30.0,
39
- max_concurrency: Optional[int] = None,
37
+ max_concurrency: int | None = None,
40
38
  enable_caching: bool = True,
41
39
  cache_ttl: int = 300,
42
40
  enable_rate_limiting: bool = False,
43
- global_rate_limit: Optional[int] = None,
44
- tool_rate_limits: Optional[Dict[str, tuple]] = None,
41
+ global_rate_limit: int | None = None,
42
+ tool_rate_limits: dict[str, tuple] | None = None,
45
43
  enable_retries: bool = True,
46
44
  max_retries: int = 3,
47
45
  namespace: str = "http",
48
- ) -> Tuple[ToolProcessor, StreamManager]:
46
+ ) -> tuple[ToolProcessor, StreamManager]:
49
47
  """
50
48
  Initialize HTTP Streamable transport MCP + a :class:`ToolProcessor`.
51
49
 
52
50
  This uses the modern HTTP Streamable transport (spec 2025-03-26) which
53
51
  provides better infrastructure compatibility and more flexible response
54
52
  handling compared to the deprecated SSE transport.
55
-
53
+
56
54
  Call with ``await`` from your async context.
57
-
55
+
58
56
  Args:
59
57
  servers: List of server configurations with 'name', 'url', and optionally 'api_key' keys
60
58
  server_names: Optional mapping of server indices to names
@@ -69,10 +67,10 @@ async def setup_mcp_http_streamable(
69
67
  enable_retries: Whether to enable automatic retries
70
68
  max_retries: Maximum retry attempts
71
69
  namespace: Namespace for registered tools
72
-
70
+
73
71
  Returns:
74
72
  Tuple of (ToolProcessor, StreamManager)
75
-
73
+
76
74
  Example:
77
75
  >>> servers = [
78
76
  ... {
@@ -116,4 +114,4 @@ async def setup_mcp_http_streamable(
116
114
  "" if len(registered) == 1 else "s",
117
115
  namespace,
118
116
  )
119
- return processor, stream_manager
117
+ return processor, stream_manager
@@ -13,8 +13,6 @@ It:
13
13
 
14
14
  from __future__ import annotations
15
15
 
16
- from typing import Dict, List, Optional, Tuple
17
-
18
16
  from chuk_tool_processor.core.processor import ToolProcessor
19
17
  from chuk_tool_processor.logging import get_logger
20
18
  from chuk_tool_processor.mcp.register_mcp_tools import register_mcp_tools
@@ -28,25 +26,25 @@ logger = get_logger("chuk_tool_processor.mcp.setup_sse")
28
26
  # --------------------------------------------------------------------------- #
29
27
  async def setup_mcp_sse( # noqa: C901 - long but just a config facade
30
28
  *,
31
- servers: List[Dict[str, str]],
32
- server_names: Optional[Dict[int, str]] = None,
29
+ servers: list[dict[str, str]],
30
+ server_names: dict[int, str] | None = None,
33
31
  connection_timeout: float = 30.0, # 🔧 INCREASED DEFAULT: was 10.0
34
- default_timeout: float = 30.0, # 🔧 INCREASED DEFAULT: was 10.0
35
- max_concurrency: Optional[int] = None,
32
+ default_timeout: float = 30.0, # 🔧 INCREASED DEFAULT: was 10.0
33
+ max_concurrency: int | None = None,
36
34
  enable_caching: bool = True,
37
35
  cache_ttl: int = 300,
38
36
  enable_rate_limiting: bool = False,
39
- global_rate_limit: Optional[int] = None,
40
- tool_rate_limits: Optional[Dict[str, tuple]] = None,
37
+ global_rate_limit: int | None = None,
38
+ tool_rate_limits: dict[str, tuple] | None = None,
41
39
  enable_retries: bool = True,
42
40
  max_retries: int = 3,
43
41
  namespace: str = "sse",
44
- ) -> Tuple[ToolProcessor, StreamManager]:
42
+ ) -> tuple[ToolProcessor, StreamManager]:
45
43
  """
46
44
  Initialise SSE-transport MCP + a :class:`ToolProcessor`.
47
45
 
48
46
  Call with ``await`` from your async context.
49
-
47
+
50
48
  Args:
51
49
  servers: List of server configurations with 'name' and 'url' keys
52
50
  server_names: Optional mapping of server indices to names
@@ -61,7 +59,7 @@ async def setup_mcp_sse( # noqa: C901 - long but just a config facade
61
59
  enable_retries: Whether to enable automatic retries
62
60
  max_retries: Maximum retry attempts
63
61
  namespace: Namespace for registered tools
64
-
62
+
65
63
  Returns:
66
64
  Tuple of (ToolProcessor, StreamManager)
67
65
  """
@@ -70,7 +68,7 @@ async def setup_mcp_sse( # noqa: C901 - long but just a config facade
70
68
  servers=servers,
71
69
  server_names=server_names,
72
70
  connection_timeout=connection_timeout, # 🔧 ADD THIS LINE
73
- default_timeout=default_timeout, # 🔧 ADD THIS LINE
71
+ default_timeout=default_timeout, # 🔧 ADD THIS LINE
74
72
  )
75
73
 
76
74
  # 2️⃣ pull the remote tool list and register each one locally
@@ -95,4 +93,4 @@ async def setup_mcp_sse( # noqa: C901 - long but just a config facade
95
93
  "" if len(registered) == 1 else "s",
96
94
  namespace,
97
95
  )
98
- return processor, stream_manager
96
+ return processor, stream_manager
@@ -13,8 +13,6 @@ It:
13
13
 
14
14
  from __future__ import annotations
15
15
 
16
- from typing import Dict, List, Optional, Tuple
17
-
18
16
  from chuk_tool_processor.core.processor import ToolProcessor
19
17
  from chuk_tool_processor.logging import get_logger
20
18
  from chuk_tool_processor.mcp.register_mcp_tools import register_mcp_tools
@@ -29,19 +27,19 @@ logger = get_logger("chuk_tool_processor.mcp.setup_stdio")
29
27
  async def setup_mcp_stdio( # noqa: C901 - long but just a config facade
30
28
  *,
31
29
  config_file: str,
32
- servers: List[str],
33
- server_names: Optional[Dict[int, str]] = None,
30
+ servers: list[str],
31
+ server_names: dict[int, str] | None = None,
34
32
  default_timeout: float = 10.0,
35
- max_concurrency: Optional[int] = None,
33
+ max_concurrency: int | None = None,
36
34
  enable_caching: bool = True,
37
35
  cache_ttl: int = 300,
38
36
  enable_rate_limiting: bool = False,
39
- global_rate_limit: Optional[int] = None,
40
- tool_rate_limits: Optional[Dict[str, tuple]] = None,
37
+ global_rate_limit: int | None = None,
38
+ tool_rate_limits: dict[str, tuple] | None = None,
41
39
  enable_retries: bool = True,
42
40
  max_retries: int = 3,
43
41
  namespace: str = "mcp",
44
- ) -> Tuple[ToolProcessor, StreamManager]:
42
+ ) -> tuple[ToolProcessor, StreamManager]:
45
43
  """
46
44
  Initialise stdio-transport MCP + a :class:`ToolProcessor`.
47
45
 
@@ -79,4 +77,4 @@ async def setup_mcp_stdio( # noqa: C901 - long but just a config facade
79
77
  "" if len(registered) == 1 else "s",
80
78
  namespace,
81
79
  )
82
- return processor, stream_manager
80
+ return processor, stream_manager