Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
fix(python): preserve explicit empty tool schemas
jkomyno507c4fe3a84a
diff --git a/python/composio/core/provider/_openai_responses.py b/python/composio/core/provider/_openai_responses.pyindex 9aaae9bf2..1f4a53ec9 100644--- a/python/composio/core/provider/_openai_responses.py+++ b/python/composio/core/provider/_openai_responses.py@@ -56,7 +56,9 @@ class OpenAIResponsesProvider(def wrap_tool(self, tool: Tool) -> ResponsesTool:"""Wrap a tool for the Responses API format."""- parameters: t.Any = tool.input_parameters or {}+ parameters: t.Any = (+ tool.input_parameters if tool.input_parameters is not None else {}+ )wrapped: ResponsesTool = {"type": "function","name": tool.slug,@@ -72,7 +74,11 @@ class OpenAIResponsesProvider(# strict rewrite keeps every parameter (optional ones become nullable)# and reports constructs it cannot express; such a tool is sent# without strict mode rather than with a narrower schema.- source = parameters if tool.input_parameters else dict(_EMPTY_OBJECT_SCHEMA)+ source = (+ parameters+ if tool.input_parameters is not None+ else dict(_EMPTY_OBJECT_SCHEMA)+ )strict = to_strict_json_schema(source)if strict.unsupported:reasons = "; ".join(diff --git a/python/tests/test_strict_schema.py b/python/tests/test_strict_schema.pyindex 4dc7dcc3f..57daad494 100644--- a/python/tests/test_strict_schema.py+++ b/python/tests/test_strict_schema.py@@ -596,6 +596,15 @@ class TestOpenAIResponsesProviderStrict:"additionalProperties": False,}+ def test_wrap_tool_keeps_explicit_empty_schema_without_strict(self):+ from composio.core.provider._openai_responses import OpenAIResponsesProvider++ provider = OpenAIResponsesProvider(strict=True)+ wrapped = provider.wrap_tool(self._tool({}))++ assert wrapped["strict"] is False+ assert wrapped["parameters"] == {}+def test_execute_tool_call_omits_null_arguments_in_strict_mode(self):from openai.types.responses.response_output_item import ResponseFunctionToolCall