freemo
7c2f5a1c76
fix(mcp): correct MCPToolResult.data type annotation for MCP 1.4.0 content list format
...
- What was implemented
- Updated MCPToolResult.data docstring to document the normalisation behaviour, clarifying that MCP 1.4.0 list-format content is normalised to a dict with a "content" key.
- Updated MCPToolAdapter.invoke() success path to normalise MCP 1.4.0 list-format content: when content is a list (as per MCP 1.4.0 spec), it is wrapped as {"content": [...]} so MCPToolResult.data is always dict[str, Any].
- Updated MockMCPTransport.call() to return MCP 1.4.0-compliant list-format content: invoke_results are now wrapped as [{"type": "text", "text": json.dumps(payload)}] instead of the non-standard dict format.
- Added json import to mock_mcp_transport.py to support JSON payload encoding.
- Updated existing mcp_adapter.feature scenario "Invoke a discovered tool successfully" to check for "content" key instead of "id" (since mock now returns MCP 1.4.0 list format).
- Added two new Behave scenarios: "Invoke tool returns MCP 1.4.0 list-format content normalised to dict" and "Invoke tool with MCP 1.4.0 content list stores content items".
- Added corresponding step definitions for the new scenarios.
- All 14,418 existing scenarios continue to pass; 2 new scenarios added; typecheck passes with 0 errors; lint passes.
- Why this approach
- Design decision: Normalize to dict (Option B) to maintain a consistent MCPToolResult.data type of dict[str, Any] and avoid breaking downstream code that accesses result.data["key"].
- Fallback path handles non-standard server responses gracefully, ensuring robustness when servers deviate from MCP 1.4.0 spec.
- Technical approach and affected components
- Core: MCPToolResult data handling and MCPToolAdapter.invoke() logic
- Mocks: mock_mcp_transport.py updated to emit MCP 1.4.0 list-format content
- Tests: updated mcp_adapter.feature expectations; added two Behave scenarios with new step definitions
- Dependencies: added import json to mock_mcp_transport.py
- Verification
- Comprehensive test suites: 14,418 existing scenarios pass
- 2 new scenarios added and pass
- Typechecking: 0 errors
- Linting: passes
ISSUES CLOSED : #2743
2026-04-05 07:48:02 +00:00
..
2026-04-03 00:29:46 +00:00
2026-03-31 16:01:58 +00:00
2026-03-31 21:47:12 +00:00
2026-04-03 00:29:46 +00:00
2026-04-04 20:38:16 +00:00
2026-04-04 20:38:16 +00:00
2026-04-04 20:38:16 +00:00
2026-04-04 20:38:16 +00:00
2026-04-04 20:38:16 +00:00
2026-04-02 23:53:13 +00:00
2026-04-01 06:16:41 +00:00
2026-04-01 06:16:41 +00:00
2026-03-31 21:47:12 +00:00
2026-03-30 23:40:36 +01:00
2026-04-03 00:23:58 +00:00
2026-03-26 13:41:31 +00:00
2026-03-30 18:27:59 +00:00
2026-04-04 20:38:16 +00:00
2026-03-30 19:35:23 +00:00
2026-03-31 21:47:12 +00:00
2026-03-28 05:27:14 +00:00
2026-03-28 05:27:14 +00:00
2026-03-26 13:41:31 +00:00
2026-03-31 16:01:58 +00:00
2026-03-31 16:01:58 +00:00
2026-04-02 16:53:03 +00:00
2026-04-04 20:38:16 +00:00
2026-03-30 17:06:49 -04:00
2026-03-31 21:47:12 +00:00
2026-03-27 23:53:22 +00:00
2026-04-04 20:38:16 +00:00
2026-04-02 17:00:53 +00:00
2026-04-02 16:59:07 +00:00
2026-04-02 06:21:49 +00:00
2026-03-30 13:18:07 +01:00
2026-03-30 13:18:07 +01:00
2026-03-30 13:18:07 +01:00
2026-03-30 13:18:07 +01:00
2026-03-30 13:18:07 +01:00
2026-04-01 01:46:37 +00:00
2026-03-31 21:47:12 +00:00
2026-03-30 21:39:26 +00:00
2026-03-31 11:03:20 +00:00
2026-04-02 19:09:04 +00:00
2026-04-02 19:09:04 +00:00
2026-04-02 19:09:04 +00:00
2026-03-31 21:47:12 +00:00
2026-04-02 19:09:04 +00:00
2026-04-02 19:09:04 +00:00
2026-03-31 21:47:12 +00:00
2026-04-01 06:16:41 +00:00
2026-03-31 21:47:12 +00:00
2026-03-31 21:47:12 +00:00
2026-03-30 21:48:01 +00:00
2026-03-30 21:48:01 +00:00
2026-03-27 12:57:03 +00:00
2026-03-30 21:39:26 +00:00
2026-03-29 16:23:04 +01:00
2026-03-30 17:06:49 -04:00
2026-03-31 21:47:12 +00:00
2026-04-02 16:59:40 +00:00
2026-04-02 08:31:27 +00:00
2026-04-02 16:58:36 +00:00
2026-03-31 11:03:20 +00:00
2026-04-04 20:38:16 +00:00
2026-03-31 21:47:12 +00:00
2026-03-26 07:52:09 +00:00
2026-04-04 20:38:16 +00:00
2026-03-30 23:40:36 +01:00
2026-03-30 23:40:36 +01:00
2026-03-30 23:40:36 +01:00
2026-04-04 20:38:16 +00:00
2026-03-31 21:47:12 +00:00
2026-04-01 06:16:41 +00:00
2026-04-04 20:38:16 +00:00
2026-03-31 21:47:12 +00:00
2026-04-02 17:08:52 +00:00
2026-03-27 23:53:22 +00:00
2026-04-03 02:01:45 +00:00
2026-04-04 20:38:16 +00:00
2026-04-02 17:07:48 +00:00
2026-04-02 16:53:03 +00:00
2026-04-02 16:59:07 +00:00
2026-03-31 16:01:58 +00:00
2026-03-31 11:31:00 +00:00
2026-03-31 21:47:12 +00:00
2026-03-31 16:01:58 +00:00
2026-03-31 21:47:12 +00:00
2026-03-30 13:19:08 +00:00
2026-04-02 16:58:39 +00:00
2026-03-31 21:47:12 +00:00
2026-03-31 21:47:12 +00:00
2026-03-31 21:47:12 +00:00
2026-03-29 18:57:15 +01:00
2026-04-02 16:59:14 +00:00
2026-03-30 09:21:51 +00:00
2026-03-27 11:10:56 +00:00
2026-04-02 16:58:32 +00:00
2026-03-31 21:47:12 +00:00
2026-03-30 11:51:27 +00:00
2026-03-31 21:47:12 +00:00
2026-04-02 16:52:33 +00:00
2026-03-31 21:47:12 +00:00
2026-03-31 21:47:12 +00:00
2026-04-04 23:48:02 +00:00
2026-04-02 16:52:33 +00:00
2026-03-31 21:47:12 +00:00
2026-04-02 19:09:04 +00:00
2026-04-02 16:53:03 +00:00
2026-04-04 20:38:16 +00:00
2026-04-04 20:38:16 +00:00
2026-03-30 13:18:07 +01:00
2026-03-30 17:48:48 +00:00
2026-03-31 21:47:12 +00:00
2026-03-31 21:47:12 +00:00
2026-04-05 07:48:02 +00:00
2026-03-30 22:42:15 +00:00
2026-03-30 22:42:15 +00:00
2026-03-30 23:40:36 +01:00
2026-04-02 16:58:36 +00:00
2026-03-30 19:52:51 +00:00
2026-03-31 21:47:12 +00:00
2026-03-29 18:57:15 +01:00
2026-04-02 17:08:38 +00:00
2026-04-02 17:07:41 +00:00
2026-04-02 19:09:04 +00:00
2026-04-02 19:09:04 +00:00
2026-04-02 19:09:04 +00:00
2026-04-02 19:09:04 +00:00
2026-03-30 17:06:49 -04:00
2026-04-04 20:38:16 +00:00
2026-04-02 19:09:04 +00:00
2026-03-31 01:49:16 +00:00
2026-04-03 20:50:17 +00:00
2026-04-02 19:09:04 +00:00
2026-03-30 17:06:49 -04:00
2026-04-02 19:09:04 +00:00
2026-04-02 19:09:04 +00:00
2026-04-02 19:09:04 +00:00
2026-03-30 23:40:36 +01:00
2026-03-30 13:18:07 +01:00
2026-03-31 21:47:12 +00:00
2026-04-01 04:27:09 +00:00
2026-03-30 13:18:07 +01:00
2026-04-03 13:38:33 -04:00
2026-04-04 20:38:16 +00:00
2026-03-30 23:40:36 +01:00
2026-04-04 20:38:16 +00:00
2026-04-03 00:01:48 +00:00
2026-03-30 23:40:36 +01:00
2026-04-02 21:30:05 +00:00
2026-04-04 20:38:16 +00:00
2026-04-02 16:59:48 +00:00
2026-03-31 21:47:12 +00:00
2026-03-30 17:12:20 +00:00
2026-03-30 08:42:48 +00:00
2026-03-30 14:33:28 +00:00
2026-03-30 14:33:28 +00:00
2026-03-31 21:47:12 +00:00
2026-03-31 21:47:12 +00:00
2026-03-30 10:18:19 +00:00
2026-03-30 10:18:19 +00:00
2026-03-30 23:40:36 +01:00
2026-03-30 23:40:36 +01:00
2026-03-30 23:40:36 +01:00
2026-03-30 13:18:07 +01:00
2026-03-31 21:47:12 +00:00
2026-04-02 08:31:27 +00:00
2026-04-02 08:31:27 +00:00
2026-04-04 20:38:16 +00:00
2026-04-01 13:02:24 +00:00
2026-04-04 20:38:16 +00:00
2026-04-04 20:38:16 +00:00
2026-03-31 21:47:12 +00:00
2026-04-02 08:31:27 +00:00
2026-04-02 08:31:27 +00:00
2026-03-30 13:44:54 +00:00
2026-03-31 21:47:12 +00:00
2026-03-28 00:57:51 +00:00
2026-04-02 16:53:03 +00:00
2026-03-29 18:57:15 +01:00
2026-03-29 18:57:15 +01:00
2026-03-31 21:47:12 +00:00
2026-03-29 18:57:15 +01:00
2026-04-02 17:00:53 +00:00
2026-03-30 13:18:07 +01:00
2026-03-27 23:53:22 +00:00
2026-04-04 20:38:16 +00:00
2026-04-04 23:08:32 +00:00
2026-04-04 23:08:32 +00:00
2026-03-31 21:47:12 +00:00
2026-04-04 20:38:16 +00:00
2026-03-31 23:57:39 +00:00
2026-03-28 05:27:14 +00:00
2026-03-28 05:27:14 +00:00
2026-04-03 19:00:22 +00:00
2026-04-02 16:50:50 +00:00
2026-03-27 05:58:35 +00:00
2026-04-02 16:51:15 +00:00
2026-03-27 05:58:35 +00:00
2026-04-02 16:51:29 +00:00
2026-03-28 00:30:26 +00:00
2026-03-27 05:58:35 +00:00
2026-03-27 22:53:33 +00:00
2026-03-27 05:58:35 +00:00
2026-03-27 05:58:35 +00:00
2026-03-27 05:58:35 +00:00
2026-04-03 03:58:45 +00:00
2026-04-03 19:03:15 +00:00
2026-03-28 04:15:49 +00:00
2026-04-02 19:09:04 +00:00
2026-04-01 00:40:46 +00:00
2026-03-30 17:06:49 -04:00
2026-03-27 05:58:35 +00:00
2026-03-27 05:58:35 +00:00
2026-03-27 05:58:35 +00:00
2026-03-27 05:58:35 +00:00
2026-04-04 20:38:16 +00:00
2026-03-27 05:58:35 +00:00
2026-03-27 05:58:35 +00:00
2026-03-27 05:58:35 +00:00
2026-03-27 05:58:35 +00:00
2026-03-27 05:58:35 +00:00
2026-03-27 05:58:35 +00:00
2026-04-01 04:27:09 +00:00
2026-03-31 07:42:06 +00:00
2026-04-02 23:53:13 +00:00
2026-04-02 23:59:37 +00:00
2026-04-02 17:07:26 +00:00
2026-04-02 16:53:03 +00:00
2026-04-02 16:53:03 +00:00
2026-04-02 17:07:26 +00:00
2026-04-02 17:07:26 +00:00
2026-04-02 17:07:26 +00:00
2026-04-02 17:07:26 +00:00
2026-03-31 11:31:00 +00:00
2026-03-29 18:57:15 +01:00
2026-04-01 21:51:14 +00:00
2026-04-04 20:38:16 +00:00
2026-04-01 21:51:14 +00:00
2026-04-03 05:56:27 +00:00
2026-04-02 17:08:13 +00:00
2026-04-04 20:38:16 +00:00
2026-04-02 20:48:33 +00:00
2026-04-01 09:23:21 +00:00
2026-04-03 05:56:27 +00:00
2026-04-02 17:09:15 +00:00
2026-03-31 21:47:12 +00:00
2026-04-01 03:30:00 +00:00
2026-04-04 20:38:16 +00:00
2026-03-30 11:47:37 +08:00