From 9b09cb5c63a07b042fa8e02b04e1445f8e7618a3 Mon Sep 17 00:00:00 2001 From: Kiplangat Korir <153384040+kiplangatkorir@users.noreply.github.com> Date: Mon, 2 Feb 2026 20:52:30 +0300 Subject: [PATCH] Update nanobot/agent/tools/base.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --- nanobot/agent/tools/base.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nanobot/agent/tools/base.py b/nanobot/agent/tools/base.py index 355150f..5888a77 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="")