updated socket protocol implementation to be compatible with 1.0v#72
updated socket protocol implementation to be compatible with 1.0v#72h3xxit merged 16 commits intouniversal-tool-calling-protocol:devuniversal-tool-calling-protocol/python-utcp:devfrom Thuraabtech:issue/socket-1.0vThuraabtech/python-utcp:issue/socket-1.0vCopy head branch name to clipboard
Conversation
…tool-calling-protocol/dev Add docs and update http to 1.0.2
…tool-calling-protocol/dev Fix response json parsing when content type is wrong
…om universal-tool-calling-protocol/dev Update CLI
…tool-calling-protocol/dev Update docs
…tool-calling-protocol/dev Plugin updates
…tool-calling-protocol/dev Add WebSocket transport implementation for real-time communication …
There was a problem hiding this comment.
Pull Request Overview
This PR updates the socket plugin (UDP/TCP) to align with UTCP 1.0 conventions, implementing standardized interfaces and adding comprehensive testing infrastructure.
Key Changes:
- Migrated from legacy
ClientTransportInterfacetoCommunicationProtocolwith updated method signatures (register_manual,call_tool, etc.) - Implemented
_ensure_tool_call_templatenormalization logic to handle legacytool_providerconversion and preserve explicittool_call_templatedefinitions - Added plugin registration infrastructure with auto-loading via entry points and comprehensive test coverage for UDP/TCP transports
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| socket_plugin_test.py | Root-level sanity test verifying plugin registration |
| scripts/socket_sanity.py | End-to-end verification script with mock UDP/TCP servers |
| test_udp_communication_protocol.py | Unit tests for UDP transport normalization scenarios |
| test_tcp_communication_protocol.py | Unit tests for TCP transport normalization scenarios |
| udp_communication_protocol.py | Updated UDP transport to UTCP 1.0 interface with normalization logic |
| udp_call_template.py | Added UDPProviderSerializer for legacy provider conversion |
| tcp_communication_protocol.py | Updated TCP transport to UTCP 1.0 interface with normalization logic |
| tcp_call_template.py | Added TCPProviderSerializer and fixed delimiter escape sequences in docstring |
| __init__.py | Plugin registration function for UDP/TCP transports and serializers |
| pyproject.toml | Added entry point for plugin auto-loading |
| README.md | Documentation for running tests and sanity checks |
| test.yml | Updated CI to include socket plugin tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
scripts/socket_sanity.py
Outdated
| return t | ||
|
|
||
| # ------------------------------- | ||
| # Mock TCP Server (delimiter-based)\n |
There was a problem hiding this comment.
Corrected escape sequence: removed literal '\n' from comment, should be plain text.
| # Mock TCP Server (delimiter-based)\n | |
| # Mock TCP Server (delimiter-based) |
| return [] | ||
|
|
||
| self._log_info(f"No tools found in TCP provider '{manual_call_template.name}' response") | ||
| manual = UtcpManual(tools=tools) |
There was a problem hiding this comment.
Missing required fields in UtcpManual constructor. Based on udp_communication_protocol.py line 274, UtcpManual requires utcp_version and manual_version parameters.
There was a problem hiding this comment.
1 issue found across 12 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="scripts/socket_sanity.py">
<violation number="1" location="scripts/socket_sanity.py:212">
Inside the async run_sanity function, time.sleep blocks the event loop; replace it with await asyncio.sleep to keep the coroutine non-blocking.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
scripts/socket_sanity.py
Outdated
| # Start servers | ||
| start_udp_server(udp_host, udp_port) | ||
| start_tcp_server(tcp_host, tcp_port, delimiter="\n") | ||
| time.sleep(0.2) # small delay to ensure servers are listening |
There was a problem hiding this comment.
Inside the async run_sanity function, time.sleep blocks the event loop; replace it with await asyncio.sleep to keep the coroutine non-blocking.
Prompt for AI agents
Address the following comment on scripts/socket_sanity.py at line 212:
<comment>Inside the async run_sanity function, time.sleep blocks the event loop; replace it with await asyncio.sleep to keep the coroutine non-blocking.</comment>
<file context>
@@ -0,0 +1,265 @@
+ # Start servers
+ start_udp_server(udp_host, udp_port)
+ start_tcp_server(tcp_host, tcp_port, delimiter="\n")
+ time.sleep(0.2) # small delay to ensure servers are listening
+
+ # Transports
</file context>
| time.sleep(0.2) # small delay to ensure servers are listening | |
| await asyncio.sleep(0.2) # small delay to ensure servers are listening |
✅ Addressed in 9cea90f
|
hi @h3xxit, the test is failing as the mcp_use requires langchain.globals but in the newer langchain API it is named as langchain_core.globals |
| "langchain==0.3.27", | ||
| "langchain-core==0.3.27" |
There was a problem hiding this comment.
Probably unintended changes to the MCP package. Please remove
There was a problem hiding this comment.
I saw that the tests were failing, so i added the langchain dependencies. Even after adding the dependency, the test is still failing. Now i've removed the mcp_use dependency on langchain.
|
@Thuraabtech Nice! Looks very good. Thank you for the contribution once again! |
|
Loved doing it! Amigo! 😊 |
Scope
This PR updates the socket plugin (UDP/TCP) to align with UTCP 1.0 behavior and interface standards. It refines how manual registrations are normalized, adds targeted tests, and ensures consistent behavior with other non-streaming transports.
Key Changes
UTCP Alignment
Updated UDPTransport and TCPTransport to match UTCP 1.0 conventions.
Implemented register_manual normalization logic to handle legacy tool_provider objects and preserve explicit tool_call_template definitions.
Plugin Registration
Added a register() function in utcp_socket/init.py that registers both transports (udp, tcp) and their serializers.
Ensured plugin auto-loads via the [project.entry-points."utcp.plugins"] configuration.
Transport Behavior
call_tool formats and sends requests over UDP/TCP and decodes responses.
call_tool_streaming yields a single chunk to maintain compatibility with other non-streaming transports.
Testing
Script & CI
Added scripts/socket_sanity.py for manual verification of transport behavior.
Updated CI (.github/workflows/test.yml) to include socket plugin tests during the main test run.
How to Run Locally
Summary by cubic
Updated the UDP/TCP socket plugin to align with UTCP 1.0 and ensure consistent non-streaming behavior. This addresses the socket-1.0v issue with auto-registration, normalized manual registrations, and full test coverage.
New Features
Bug Fixes