From bf84cdfa5e88759774f71d98906fcb5e7704a980 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sun, 29 Mar 2026 15:49:21 -0700 Subject: [PATCH] fix: ensure tool schema always includes name field in get_definitions (#3811) When a tool plugin registers a schema without an explicit 'name' key, get_definitions() crashes with KeyError: available_tool_names = {t["function"]["name"] for t in filtered_tools} Fix: always merge entry.name into schema so 'name' is never missing. Refs: #3729 Co-authored-by: ekkoitac --- tools/registry.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/registry.py b/tools/registry.py index a20abf49d..b124faf6b 100644 --- a/tools/registry.py +++ b/tools/registry.py @@ -115,7 +115,9 @@ class ToolRegistry: if not quiet: logger.debug("Tool %s unavailable (check failed)", name) continue - result.append({"type": "function", "function": entry.schema}) + # Ensure schema always has a "name" field — use entry.name as fallback + schema_with_name = {**entry.schema, "name": entry.name} + result.append({"type": "function", "function": schema_with_name}) return result # ------------------------------------------------------------------