-
Notifications
You must be signed in to change notification settings - Fork 39
Fix bug in mcp plugin #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ng conventions (#80) Co-authored-by: Mario Korte <mko@biss-net.com>
There was a problem hiding this 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 `{"result": ...}` 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} |
There was a problem hiding this comment.
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"{HTTP_SERVER_NAME}.add_numbers", {"a": 5, "b": 7}, http_mcp_provider)
- assert result == 12
+ assert result == {"result": 12}
</file context>
| assert result == {"result": 12} | |
| assert result == 12 |
✅ Addressed in 5f25643
| assert isinstance(result, dict) | ||
| assert "result" in result | ||
| assert result == {"result": ["item_0", "item_1", "item_2"]} |
There was a problem hiding this comment.
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] == "item_0"
- assert result[1] == "item_1"
- assert result[2] == "item_2"
+ assert isinstance(result, dict)
+ assert "result" in result
+ assert result == {"result": ["item_0", "item_1", "item_2"]}
</file context>
| 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!"} |
There was a problem hiding this comment.
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 `{"result": ...}` 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"{HTTP_SERVER_NAME}.greet", {"name": "Alice"}, http_mcp_provider)
- assert result == "Hello, Alice!"
+ assert result == {"result": "Hello, Alice!"}
</file context>
| 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} |
There was a problem hiding this comment.
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"{SERVER_NAME}.add_numbers", {"a": 5, "b": 7}, mcp_manual)
- assert result == 12
+ assert result == {"result": 12}
</file context>
| assert result == {"result": 12} | |
| assert result == 12 |
✅ Addressed in 5f25643
| assert isinstance(result, dict) | ||
| assert "result" in result | ||
| assert result == {"result": ["item_0", "item_1", "item_2"]} |
There was a problem hiding this comment.
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 == ["item_0", "item_1", "item_2"]
+ assert isinstance(result, dict)
+ assert "result" in result
+ assert result == {"result": ["item_0", "item_1", "item_2"]}
</file context>
| 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!"} |
There was a problem hiding this comment.
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"{SERVER_NAME}.greet", {"name": "Alice"}, mcp_manual)
- assert result == "Hello, Alice!"
+ assert result == {"result": "Hello, Alice!"}
</file context>
| assert result == {"result": "Hello, Alice!"} | |
| assert result == "Hello, Alice!" |
✅ Addressed in 5f25643
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
Migration
Written for commit 5f25643. Summary will update automatically on new commits.