Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
fix(python): preserve explicit empty tool schemas
jkomyno committed
Aug 27, 2026 at 15:38 UTC
507c4fe3a84a802511544bde6846e0fd51a2a128
2 files changed
+17
-2
python/composio/core/provider/_openai_responses.py
+8
-2
@@ -56,7 +56,9 @@ class OpenAIResponsesProvider(
56
57
def wrap_tool(self, tool: Tool) -> ResponsesTool:
58
"""Wrap a tool for the Responses API format."""
59
- parameters: t.Any = tool.input_parameters or {}
59
+ parameters: t.Any = (
60
+ tool.input_parameters if tool.input_parameters is not None else {}
61
+ )
62
wrapped: ResponsesTool = {
63
"type": "function",
64
"name": tool.slug,
@@ -72,7 +74,11 @@ class OpenAIResponsesProvider(
74
# strict rewrite keeps every parameter (optional ones become nullable)
75
# and reports constructs it cannot express; such a tool is sent
76
# without strict mode rather than with a narrower schema.
75
- source = parameters if tool.input_parameters else dict(_EMPTY_OBJECT_SCHEMA)
77
+ source = (
78
+ parameters
79
+ if tool.input_parameters is not None
80
+ else dict(_EMPTY_OBJECT_SCHEMA)
81
+ )
82
strict = to_strict_json_schema(source)
83
if strict.unsupported:
84
reasons = "; ".join(
python/tests/test_strict_schema.py
+9
@@ -596,6 +596,15 @@ class TestOpenAIResponsesProviderStrict:
596
"additionalProperties": False,
597
}
598
599
+ def test_wrap_tool_keeps_explicit_empty_schema_without_strict(self):
600
+ from composio.core.provider._openai_responses import OpenAIResponsesProvider
601
+
602
+ provider = OpenAIResponsesProvider(strict=True)
603
+ wrapped = provider.wrap_tool(self._tool({}))
604
+
605
+ assert wrapped["strict"] is False
606
+ assert wrapped["parameters"] == {}
607
+
608
def test_execute_tool_call_omits_null_arguments_in_strict_mode(self):
609
from openai.types.responses.response_output_item import ResponseFunctionToolCall
610