From 31d221b47e2cb55ca559671bf9398255c3f148ca Mon Sep 17 00:00:00 2001 From: Kian Jones <11655409+kianjones9@users.noreply.github.com> Date: Fri, 6 Feb 2026 16:50:06 -0800 Subject: [PATCH] fix: handle MCP tool schemas missing `properties` key gracefully (#9347) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- letta/functions/schema_generator.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/letta/functions/schema_generator.py b/letta/functions/schema_generator.py index 3f549069..de811488 100644 --- a/letta/functions/schema_generator.py +++ b/letta/functions/schema_generator.py @@ -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