Skip to content

Conversation

Prikalel
Copy link

@Prikalel Prikalel commented Sep 10, 2025

fixes #11 and some other stuff


Summary by cubic

Expose the MCP bridge externally and fix tool invocation in generated proxies to prevent call failures. Fixes #11.

  • Bug Fixes
    • Proxy functions now call client.call_tool and receive client in their namespace to avoid NameError and failed tool calls.
    • docker-compose binds HOST to 0.0.0.0 so the service is reachable from outside the container.

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.

2 issues found across 2 files

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

@@ -83,10 +83,10 @@ def get(obj, attr, default=None):
for py_name_safe, orig_name in param_map.items():
func_code += f" if {py_name_safe} is not None:\n"
func_code += f" args['{orig_name}'] = {py_name_safe}\n"
func_code += f" return await bridge.client.call_tool('{get(tool, 'name')}', args)\n"
func_code += f" return await client.call_tool('{get(tool, 'name')}', args)\n"
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 10, 2025

Choose a reason for hiding this comment

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

Tool name is inserted into generated code without escaping; a single quote in the name will break the generated function string.

Prompt for AI agents
Address the following comment on web_ui_utcp_mcp_bridge/src/utcp_proxy_mcp.py at line 86:

<comment>Tool name is inserted into generated code without escaping; a single quote in the name will break the generated function string.</comment>

<file context>
@@ -83,10 +83,10 @@ def get(obj, attr, default=None):
             func_code += f&quot;    if {py_name_safe} is not None:\n&quot;
             func_code += f&quot;        args[&#39;{orig_name}&#39;] = {py_name_safe}\n&quot;
-        func_code += f&quot;    return await bridge.client.call_tool(&#39;{get(tool, &#39;name&#39;)}&#39;, args)\n&quot;
+        func_code += f&quot;    return await client.call_tool(&#39;{get(tool, &#39;name&#39;)}&#39;, args)\n&quot;
 
         # Create function
</file context>
Suggested change
func_code += f" return await client.call_tool('{get(tool, 'name')}', args)\n"
func_code += f" return await client.call_tool({get(tool, 'name')!r}, args)\n"
Fix with Cubic

@@ -83,10 +83,10 @@ def get(obj, attr, default=None):
for py_name_safe, orig_name in param_map.items():
func_code += f" if {py_name_safe} is not None:\n"
func_code += f" args['{orig_name}'] = {py_name_safe}\n"
func_code += f" return await bridge.client.call_tool('{get(tool, 'name')}', args)\n"
func_code += f" return await client.call_tool('{get(tool, 'name')}', args)\n"
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 10, 2025

Choose a reason for hiding this comment

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

Generated proxy references client, but exec assigns it only to locals; at runtime client is not in the function's globals, causing NameError when the proxy is called.

Prompt for AI agents
Address the following comment on web_ui_utcp_mcp_bridge/src/utcp_proxy_mcp.py at line 86:

<comment>Generated proxy references client, but exec assigns it only to locals; at runtime client is not in the function&#39;s globals, causing NameError when the proxy is called.</comment>

<file context>
@@ -83,10 +83,10 @@ def get(obj, attr, default=None):
             func_code += f&quot;    if {py_name_safe} is not None:\n&quot;
             func_code += f&quot;        args[&#39;{orig_name}&#39;] = {py_name_safe}\n&quot;
-        func_code += f&quot;    return await bridge.client.call_tool(&#39;{get(tool, &#39;name&#39;)}&#39;, args)\n&quot;
+        func_code += f&quot;    return await client.call_tool(&#39;{get(tool, &#39;name&#39;)}&#39;, args)\n&quot;
 
         # Create function
</file context>
Fix with Cubic

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.

name bridge is not defined
1 participant