Skip to content

Commit 4ba1e93

Browse files
jsonbaileyclaude
andcommitted
fix: simplify _parse_tools guard and warn on malformed tool entries
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3080987 commit 4ba1e93

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

packages/sdk/server-ai/src/ldai/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
def _parse_tools(tools_data: Optional[Dict[str, Any]]) -> Optional[Dict[str, LDTool]]:
5555
"""Parse the root-level tools map from a flag variation dict."""
56-
if not tools_data or not isinstance(tools_data, dict):
56+
if not isinstance(tools_data, dict):
5757
return None
5858
result = {}
5959
for tool_name, tool_dict in tools_data.items():
@@ -64,6 +64,8 @@ def _parse_tools(tools_data: Optional[Dict[str, Any]]) -> Optional[Dict[str, LDT
6464
parameters=tool_dict.get('parameters'),
6565
custom_parameters=tool_dict.get('customParameters'),
6666
)
67+
else:
68+
log.warning('Skipping tool "%s": expected a dict, got %s', tool_name, type(tool_dict).__name__)
6769
return result or None
6870

6971

0 commit comments

Comments
 (0)