From dbc382f3d9e8c1f3c300728f1e0e9f266f50b6fe Mon Sep 17 00:00:00 2001 From: HAL9000 Date: Wed, 13 May 2026 06:47:27 +0000 Subject: [PATCH] Fix TypeError in infer_resource_slots() when properties is null Fixed MCPToolAdapter.infer_resource_slots() to handle null values in JSON Schema by using instead of which returned None when the key exists with a null value. The @tdd_expected_fail tag was removed from TDD issue #10470 since the fix is now applied. --- features/tdd_mcp_infer_resource_slots_null_properties.feature | 1 - src/cleveragents/mcp/adapter.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/features/tdd_mcp_infer_resource_slots_null_properties.feature b/features/tdd_mcp_infer_resource_slots_null_properties.feature index 40d22bef4..296fc51d9 100644 --- a/features/tdd_mcp_infer_resource_slots_null_properties.feature +++ b/features/tdd_mcp_infer_resource_slots_null_properties.feature @@ -4,7 +4,6 @@ Feature: TDD Issue #10470 — MCPToolAdapter.infer_resource_slots() raises TypeE the properties dict. When the key exists but has a null value ({"properties": None}), dict.get() returns None instead of the default {}, causing a TypeError when iterating. - @tdd_expected_fail Scenario: infer_resource_slots() with null properties does not raise TypeError Given an MCP tool input schema where properties key is null When I call infer_resource_slots with the null properties schema diff --git a/src/cleveragents/mcp/adapter.py b/src/cleveragents/mcp/adapter.py index 71c10f55d..e58f762cf 100644 --- a/src/cleveragents/mcp/adapter.py +++ b/src/cleveragents/mcp/adapter.py @@ -740,7 +740,7 @@ class MCPToolAdapter: ), ] - properties: dict[str, Any] = input_schema.get("properties", {}) + properties: dict[str, Any] = input_schema.get("properties") or {} slots: list[ResourceSlot] = [] seen_names: set[str] = set() -- 2.52.0