Skip to content

Your lightweight open-source personal agent.

Update nanobot/agent/tools/base.py

Kiplangat Korir9b09cb5c63a0
diff --git a/nanobot/agent/tools/base.py b/nanobot/agent/tools/base.py
index 355150f22..5888a770c 100644
--- a/nanobot/agent/tools/base.py
+++ b/nanobot/agent/tools/base.py
@@ -51,8 +51,14 @@ class Tool(ABC):
Unknown params are ignored.
"""
schema = self.parameters or {}
- if schema.get("type") != "object":
- return []
+
+ # Default to an object schema if type is missing, and fail fast on unsupported top-level types.
+ if "type" not in schema:
+ schema = {"type": "object", **schema}
+ elif schema.get("type") != "object":
+ raise ValueError(
+ f"Tool parameter schemas must have top-level type 'object'; got {schema.get('type')!r}"
+ )
return self._validate_schema(params, schema, path="")