Skip to content

Commit 8ff40b5

Browse files
authored
fix(copilotchat): limit function names to 64 characters (#243)
Add a safeguard in `create_function_name` to ensure generated function names do not exceed 64 characters. This prevents potential issues with overly long function names when registering MCP tools and resources as CopilotChat functions.
1 parent 7804697 commit 8ff40b5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lua/mcphub/extensions/copilotchat/functions.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ local function create_function_name(server_name, item_name, opts)
3636
name = "mcp_" .. name
3737
end
3838

39+
-- Limit the name to 64 characters
40+
if #name > 64 then
41+
name = name:sub(1, 64)
42+
end
43+
3944
return name
4045
end
4146

0 commit comments

Comments
 (0)