fix: handle MCP tool schemas missing properties key gracefully (#9347)
MCP tools can have an inputSchema like `{"type": "object", "additionalProperties": false}`
with no `properties` key (valid for zero-arg tools). The hard assert on `"properties" in
parameters_schema` caused an AssertionError. Replace assertions with safe defaults.
Datadog: https://us5.datadoghq.com/error-tracking/issue/ecee9ee2-db75-11f0-ba66-da7ad0900000
🤖 Generated with [Letta Code](https://letta.com)
Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
@@ -704,8 +704,9 @@ def generate_tool_schema_for_mcp(
|
||||
name = mcp_tool.name
|
||||
description = mcp_tool.description
|
||||
|
||||
assert "type" in parameters_schema, parameters_schema
|
||||
assert "properties" in parameters_schema, parameters_schema
|
||||
if "type" not in parameters_schema:
|
||||
parameters_schema["type"] = "object"
|
||||
parameters_schema.setdefault("properties", {})
|
||||
# assert "required" in parameters_schema, parameters_schema
|
||||
|
||||
# Normalize the schema to fix common issues with MCP schemas
|
||||
|
||||
Reference in New Issue
Block a user