-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Labels
Description
Description
When importing MCP tools, schemas with {"type": "object"} but no properties field fail validation. The normalize_mcp_schema function should add properties: {} when missing.
Current Behavior
MCP servers may return tool schemas like:
{"type": "object"}This causes the error:
Failed to auto-sync tools from MCP server mcpjungle-remote: {'type': 'object', 'additionalProperties': False}.
Server was created successfully but tools were not persisted.
Expected Behavior
normalize_mcp_schema should normalize this to:
{"type": "object", "properties": {}, "additionalProperties": false}Root Cause
The issue originates from a bug in mcp-go library where empty properties gets dropped during JSON serialization. However, Letta's normalization could easily handle this case.
Suggested Fix
In letta/functions/schema_generator.py, add to normalize_mcp_schema:
def normalize_mcp_schema(schema: Dict[str, Any]) -> Dict[str, Any]:
# Add empty properties if missing for object types
if schema.get("type") == "object" and "properties" not in schema:
schema["properties"] = {}
# ... existing normalization logicImpact
This affects any MCP server that returns tools with no parameters, causing them to fail import even though they're valid tools.
Reactions are currently unavailable