Skip to content

Conversation

@h3xxit
Copy link
Member

@h3xxit h3xxit commented Dec 3, 2025

Summary by cubic

Fixes MCP plugin result handling and aligns Tool field names with MCP conventions, preventing misparsed outputs and making unstructured results consistent. Bumps plugin version to 1.1.2.

  • Bug Fixes

    • Renamed Tool fields from input_schema/output_schema to inputs/outputs.
    • Read structured output from structuredContent (was structured_output), and unwrap structuredContent["result"] when present.
    • Standardized unstructured outputs to return {"result": ...} for strings, lists, and numbers.
    • Updated tests to match the new output shape.
  • Migration

    • Replace Tool input_schema/output_schema with inputs/outputs.
    • Update callers to read response["result"] for unstructured outputs; structured outputs come from structuredContent (or its "result" when present).

Written for commit 5f25643. Summary will update automatically on new commits.

mariokorte and others added 2 commits December 3, 2025 17:39
…ng conventions (#80)

Co-authored-by: Mario Korte <mko@biss-net.com>
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.

6 issues found across 4 files

Prompt for AI agents (all 6 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="plugins/communication_protocols/mcp/tests/test_mcp_http_transport.py">

<violation number="1" location="plugins/communication_protocols/mcp/tests/test_mcp_http_transport.py:139">
P2: `transport.call_tool` returns the raw string greeting, not a `{&quot;result&quot;: ...}` dict, so this assertion will always fail.</violation>

<violation number="2" location="plugins/communication_protocols/mcp/tests/test_mcp_http_transport.py:155">
P2: List output from `transport.call_tool` is a plain list, so asserting it is a dict with a `result` key is incorrect and breaks the test.</violation>

<violation number="3" location="plugins/communication_protocols/mcp/tests/test_mcp_http_transport.py:173">
P2: `transport.call_tool` returns the integer sum, not a dict, so this assertion is incorrect.</violation>
</file>

<file name="plugins/communication_protocols/mcp/tests/test_mcp_transport.py">

<violation number="1" location="plugins/communication_protocols/mcp/tests/test_mcp_transport.py:101">
P2: `transport.call_tool` returns the raw greeting string, but this test now expects a dict, so it will always fail.</violation>

<violation number="2" location="plugins/communication_protocols/mcp/tests/test_mcp_transport.py:111">
P2: List results are returned directly, but the test now insists on a dict wrapper, causing a deterministic failure.</violation>

<violation number="3" location="plugins/communication_protocols/mcp/tests/test_mcp_transport.py:123">
P2: Numeric tool results are returned as plain numbers, but the test now expects a dict wrapper, so it will always fail.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

result = await transport.call_tool(None, f"{HTTP_SERVER_NAME}.add_numbers", {"a": 5, "b": 7}, http_mcp_provider)

assert result == 12
assert result == {"result": 12}
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 3, 2025

Choose a reason for hiding this comment

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

P2: transport.call_tool returns the integer sum, not a dict, so this assertion is incorrect.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/communication_protocols/mcp/tests/test_mcp_http_transport.py, line 173:

<comment>`transport.call_tool` returns the integer sum, not a dict, so this assertion is incorrect.</comment>

<file context>
@@ -172,7 +170,7 @@ async def test_http_numeric_output(
     result = await transport.call_tool(None, f&quot;{HTTP_SERVER_NAME}.add_numbers&quot;, {&quot;a&quot;: 5, &quot;b&quot;: 7}, http_mcp_provider)
     
-    assert result == 12
+    assert result == {&quot;result&quot;: 12}
 
 
</file context>
Suggested change
assert result == {"result": 12}
assert result == 12

✅ Addressed in 5f25643

Comment on lines 155 to 157
assert isinstance(result, dict)
assert "result" in result
assert result == {"result": ["item_0", "item_1", "item_2"]}
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 3, 2025

Choose a reason for hiding this comment

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

P2: List output from transport.call_tool is a plain list, so asserting it is a dict with a result key is incorrect and breaks the test.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/communication_protocols/mcp/tests/test_mcp_http_transport.py, line 155:

<comment>List output from `transport.call_tool` is a plain list, so asserting it is a dict with a `result` key is incorrect and breaks the test.</comment>

<file context>
@@ -152,11 +152,9 @@ async def test_http_list_output(
-    assert result[0] == &quot;item_0&quot;
-    assert result[1] == &quot;item_1&quot;
-    assert result[2] == &quot;item_2&quot;
+    assert isinstance(result, dict)
+    assert &quot;result&quot; in result
+    assert result == {&quot;result&quot;: [&quot;item_0&quot;, &quot;item_1&quot;, &quot;item_2&quot;]}
</file context>
Suggested change
assert isinstance(result, dict)
assert "result" in result
assert result == {"result": ["item_0", "item_1", "item_2"]}
assert isinstance(result, list)
assert len(result) == 3
assert result[0] == "item_0"
assert result[1] == "item_1"
assert result[2] == "item_2"

✅ Addressed in 5f25643

# Call the greet tool and verify the result
result = await transport.call_tool(None, f"{HTTP_SERVER_NAME}.greet", {"name": "Alice"}, http_mcp_provider)
assert result == "Hello, Alice!"
assert result == {"result": "Hello, Alice!"}
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 3, 2025

Choose a reason for hiding this comment

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

P2: transport.call_tool returns the raw string greeting, not a {"result": ...} dict, so this assertion will always fail.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/communication_protocols/mcp/tests/test_mcp_http_transport.py, line 139:

<comment>`transport.call_tool` returns the raw string greeting, not a `{&quot;result&quot;: ...}` dict, so this assertion will always fail.</comment>

<file context>
@@ -136,7 +136,7 @@ async def test_http_unstructured_output(
     # Call the greet tool and verify the result
     result = await transport.call_tool(None, f&quot;{HTTP_SERVER_NAME}.greet&quot;, {&quot;name&quot;: &quot;Alice&quot;}, http_mcp_provider)
-    assert result == &quot;Hello, Alice!&quot;
+    assert result == {&quot;result&quot;: &quot;Hello, Alice!&quot;}
 
 
</file context>
Suggested change
assert result == {"result": "Hello, Alice!"}
assert result == "Hello, Alice!"

✅ Addressed in 5f25643

result = await transport.call_tool(None, f"{SERVER_NAME}.add_numbers", {"a": 5, "b": 7}, mcp_manual)

assert result == 12
assert result == {"result": 12}
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 3, 2025

Choose a reason for hiding this comment

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

P2: Numeric tool results are returned as plain numbers, but the test now expects a dict wrapper, so it will always fail.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/communication_protocols/mcp/tests/test_mcp_transport.py, line 123:

<comment>Numeric tool results are returned as plain numbers, but the test now expects a dict wrapper, so it will always fail.</comment>

<file context>
@@ -120,7 +120,7 @@ async def test_numeric_output(transport: McpCommunicationProtocol, mcp_manual: M
     result = await transport.call_tool(None, f&quot;{SERVER_NAME}.add_numbers&quot;, {&quot;a&quot;: 5, &quot;b&quot;: 7}, mcp_manual)
 
-    assert result == 12
+    assert result == {&quot;result&quot;: 12}
 
 
</file context>
Suggested change
assert result == {"result": 12}
assert result == 12

✅ Addressed in 5f25643

Comment on lines 111 to 113
assert isinstance(result, dict)
assert "result" in result
assert result == {"result": ["item_0", "item_1", "item_2"]}
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 3, 2025

Choose a reason for hiding this comment

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

P2: List results are returned directly, but the test now insists on a dict wrapper, causing a deterministic failure.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/communication_protocols/mcp/tests/test_mcp_transport.py, line 111:

<comment>List results are returned directly, but the test now insists on a dict wrapper, causing a deterministic failure.</comment>

<file context>
@@ -108,9 +108,9 @@ async def test_list_output(transport: McpCommunicationProtocol, mcp_manual: McpC
-    assert isinstance(result, list)
-    assert len(result) == 3
-    assert result == [&quot;item_0&quot;, &quot;item_1&quot;, &quot;item_2&quot;]
+    assert isinstance(result, dict)
+    assert &quot;result&quot; in result
+    assert result == {&quot;result&quot;: [&quot;item_0&quot;, &quot;item_1&quot;, &quot;item_2&quot;]}
</file context>
Suggested change
assert isinstance(result, dict)
assert "result" in result
assert result == {"result": ["item_0", "item_1", "item_2"]}
assert isinstance(result, list)
assert len(result) == 3
assert result == ["item_0", "item_1", "item_2"]

✅ Addressed in 5f25643


result = await transport.call_tool(None, f"{SERVER_NAME}.greet", {"name": "Alice"}, mcp_manual)
assert result == "Hello, Alice!"
assert result == {"result": "Hello, Alice!"}
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 3, 2025

Choose a reason for hiding this comment

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

P2: transport.call_tool returns the raw greeting string, but this test now expects a dict, so it will always fail.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/communication_protocols/mcp/tests/test_mcp_transport.py, line 101:

<comment>`transport.call_tool` returns the raw greeting string, but this test now expects a dict, so it will always fail.</comment>

<file context>
@@ -98,7 +98,7 @@ async def test_unstructured_string_output(transport: McpCommunicationProtocol, m
 
     result = await transport.call_tool(None, f&quot;{SERVER_NAME}.greet&quot;, {&quot;name&quot;: &quot;Alice&quot;}, mcp_manual)
-    assert result == &quot;Hello, Alice!&quot;
+    assert result == {&quot;result&quot;: &quot;Hello, Alice!&quot;}
 
 
</file context>
Suggested change
assert result == {"result": "Hello, Alice!"}
assert result == "Hello, Alice!"

✅ Addressed in 5f25643

@h3xxit h3xxit merged commit 6bf6d66 into main Dec 3, 2025
18 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.

3 participants