package tools import ( "context" "fmt" "time" ) // NewCurrentTime creates a current_time tool that returns the current date and time. // Useful for agents that need temporal awareness. func NewCurrentTime() Tool { return Tool{ Def: Def{ Name: "current_time", Description: "Returns the current date and time in the server's timezone. Use this when you need to know the current time or date.", Parameters: []Param{ {Name: "format", Type: "string", Description: "Optional Go time format string. Defaults to RFC3339 if empty.", Required: false}, }, }, Exec: func(ctx context.Context, args map[string]any) Result { layout := getString(args, "format") if layout == "" { layout = time.RFC3339 } now := time.Now() output := fmt.Sprintf("Current time: %s\nTimezone: %s", now.Format(layout), now.Location().String()) return Result{Output: output} }, } }