Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

Add docs and update http to 1.0.2#52

Merged
h3xxit merged 4 commits intomainuniversal-tool-calling-protocol/python-utcp:mainfrom
devuniversal-tool-calling-protocol/python-utcp:devCopy head branch name to clipboard
Aug 27, 2025
Merged

Add docs and update http to 1.0.2#52
h3xxit merged 4 commits intomainuniversal-tool-calling-protocol/python-utcp:mainfrom
devuniversal-tool-calling-protocol/python-utcp:devCopy head branch name to clipboard

Conversation

@h3xxit
Copy link
Member

@h3xxit h3xxit commented Aug 27, 2025

Summary by cubic

Fix HTTP response parsing to respect Content-Type and bump utcp-http to 1.0.2. Also simplify SSE by removing active connection tracking and related teardown.

  • Bug Fixes

    • HTTP: Only parse JSON when Content-Type includes application/json; otherwise return response text to avoid JSON decode errors.
  • Refactors

    • SSE: Removed _active_connections and close(); deregister_manual is now a no-op.
    • SSE: No longer stores response/session in call_tool_streaming; the stream consumer manages lifecycle.
    • Tests: Removed close() teardown and deregister cleanup test.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 4 files

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

return await response.json()

content_type = response.headers.get('Content-Type', '')
if 'application/json' in content_type:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON detection misses +json types (e.g., application/problem+json), causing JSON bodies to be returned as text instead of parsed objects.

Prompt for AI agents
Address the following comment on plugins/communication_protocols/http/src/utcp_http/http_communication_protocol.py at line 315:

<comment>JSON detection misses +json types (e.g., application/problem+json), causing JSON bodies to be returned as text instead of parsed objects.</comment>

<file context>
@@ -310,7 +310,11 @@ async def call_tool(self, caller, tool_name: str, tool_args: Dict[str, Any], too
-                    return await response.json()
+                    
+                    content_type = response.headers.get(&#39;Content-Type&#39;, &#39;&#39;)
+                    if &#39;application/json&#39; in content_type:
+                        return await response.json()
+                    return await response.text()
</file context>

await session.close()

Deregister an SSE manual."""
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required deregistration is unimplemented, leading to potential resource leaks (open ClientSession/response) and noncompliance with the interface expectations.

Prompt for AI agents
Address the following comment on plugins/communication_protocols/http/src/utcp_http/sse_communication_protocol.py at line 151:

<comment>Required deregistration is unimplemented, leading to potential resource leaks (open ClientSession/response) and noncompliance with the interface expectations.</comment>

<file context>
@@ -148,13 +147,9 @@ async def register_manual(self, caller, manual_call_template: CallTemplate) -&gt; R
-            await session.close()
-
+        Deregister an SSE manual.&quot;&quot;&quot;
+        pass
+    
     async def call_tool(self, caller, tool_name: str, tool_args: Dict[str, Any], tool_call_template: CallTemplate) -&gt; Any:
</file context>

…ication_protocol.py

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@h3xxit h3xxit merged commit 018806c into main Aug 27, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.