Revert "feat: add strict tool calling setting [LET-6902]" (#8720)

Revert "feat: add strict tool calling setting [LET-6902] (#8577)"

This reverts commit 697c9d0dee6af73ec4d5d98780e2ca7632a69173.
This commit is contained in:
Sarah Wooders
2026-01-14 15:41:43 -08:00
parent eb748b8f1a
commit 97cdfb4225
11 changed files with 48 additions and 82 deletions

View File

@@ -8,16 +8,14 @@ from letta.utils import get_logger
logger = get_logger(__name__)
def enable_strict_mode(tool_schema: Dict[str, Any], strict: bool = True) -> Dict[str, Any]:
def enable_strict_mode(tool_schema: Dict[str, Any]) -> Dict[str, Any]:
"""Enables strict mode for a tool schema by setting 'strict' to True and
disallowing additional properties in the parameters.
If the tool schema is NON_STRICT_ONLY, strict mode will not be applied.
If strict=False, the function will only clean metadata without applying strict mode.
Args:
tool_schema (Dict[str, Any]): The original tool schema.
strict (bool): Whether to enable strict mode. Defaults to True.
Returns:
Dict[str, Any]: A new tool schema with strict mode conditionally enabled.
@@ -36,12 +34,6 @@ def enable_strict_mode(tool_schema: Dict[str, Any], strict: bool = True) -> Dict
# We should not be hitting this and allowing invalid schemas to be used
logger.error(f"Tool schema {schema} is invalid: {schema.get(MCP_TOOL_METADATA_SCHEMA_WARNINGS)}")
# If strict mode is disabled, just clean metadata and return
if not strict:
schema.pop(MCP_TOOL_METADATA_SCHEMA_STATUS, None)
schema.pop(MCP_TOOL_METADATA_SCHEMA_WARNINGS, None)
return schema
# Enable strict mode for STRICT_COMPLIANT or unspecified health status
schema["strict"] = True