// Package current_time 内置示例工具:返回服务器当前时间。 // 仅用于验证独立工具对话入口(/tool/agent 将全部注册工具交给模型 function calling),可按需移除。 package current_time import ( "context" "time" "gitea.redpowerfuture.com/red-future/common/tools" ) func init() { tools.Register(CurrentTimeTool()) } // CurrentTimeTool 返回服务器当前时间,作为 model 作用域示例工具 func CurrentTimeTool() *tools.Tool { return &tools.Tool{ Name: "current_time", Description: "返回服务器当前时间。当用户询问时间/日期时调用。", Parameters: map[string]any{ "type": "object", "properties": map[string]any{}, "required": false, }, Func: func(ctx context.Context, args map[string]any) (tools.ToolResult, error) { return tools.OK(map[string]any{ "now": time.Now().Format("2006-01-02 15:04:05"), }), nil }, } }