From bae4758111e2ee2891c8aa0903d41b307a03f284 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 29 Jul 2025 11:25:48 +0200 Subject: [PATCH] fix(functions): if schema.properties is empty, do not send schema This breaks stuff especially with github mcp server Signed-off-by: Tomas Slusny --- lua/CopilotChat/functions.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/CopilotChat/functions.lua b/lua/CopilotChat/functions.lua index c23957e5..c9d8488b 100644 --- a/lua/CopilotChat/functions.lua +++ b/lua/CopilotChat/functions.lua @@ -48,10 +48,16 @@ local function filter_schema(tbl) return tbl end + if utils.empty(tbl.properties) then + return nil + end + local result = {} for k, v in pairs(tbl) do - if type(v) ~= 'function' and k ~= 'examples' then - result[k] = type(v) == 'table' and filter_schema(v) or v + if not utils.empty(v) then + if type(v) ~= 'function' and k ~= 'examples' then + result[k] = type(v) == 'table' and filter_schema(v) or v + end end end return result