From d92e974ce6c99e68c961d2d794e519e4c45e0d1d Mon Sep 17 00:00:00 2001 From: Shen Junzheng Date: Wed, 9 Apr 2025 00:01:13 +0800 Subject: [PATCH] mcp required args --- internal/chatlog/mcp/const.go | 3 +++ internal/mcp/tool.go | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/chatlog/mcp/const.go b/internal/chatlog/mcp/const.go index 35ffe63..64ba277 100644 --- a/internal/chatlog/mcp/const.go +++ b/internal/chatlog/mcp/const.go @@ -26,6 +26,7 @@ var ( "description": "联系人的搜索关键词,可以是姓名、备注名或ID。", }, }, + Required: []string{"query"}, }, } @@ -40,6 +41,7 @@ var ( "description": "群聊的搜索关键词,可以是群名称、群ID或相关描述", }, }, + Required: []string{"query"}, }, } @@ -67,6 +69,7 @@ var ( "description": "交谈对象,可以是联系人或群聊。支持使用ID、昵称、备注名等进行查询。", }, }, + Required: []string{"time", "talker"}, }, } diff --git a/internal/mcp/tool.go b/internal/mcp/tool.go index 5cf3cce..1975740 100644 --- a/internal/mcp/tool.go +++ b/internal/mcp/tool.go @@ -92,8 +92,9 @@ type Tool struct { } type ToolSchema struct { - Type string `json:"type"` - Properties M `json:"properties"` + Type string `json:"type"` + Properties M `json:"properties"` + Required []string `json:"required,omitempty"` } // {