Files
unibots/tools/clock/clock.go
T
agent fc644ecd6e feat: import agents_and_robots platform as unibots (Matrix-out, unibus transport)
Reemplaza el scaffold del echobot por la plataforma completa de bots traida
desde ~/DataProyects/Github/agents_and_robots tras la operacion Matrix-out:
los bots ya no hablan por Matrix sino por el bus unibus (modelo todo-rooms +
E2E via shell/transportunibus sobre github.com/enmanuel/unibus/pkg/client).

- go.mod: replace de unibus -> ../unibus y de fn-registry -> ../../../.. (paths
  relativos reajustados a la nueva ubicacion dentro de fn_registry).
- app.md: bump a 0.2.0, descripcion + arquitectura + comandos + gotchas reales.
- modulo Go conservado como github.com/enmanuel/agents (sin reescribir imports).

agents_and_robots queda archivado como museo de la era Matrix.
2026-06-07 11:50:13 +02:00

34 lines
984 B
Go

package clock
import (
"context"
"fmt"
"time"
"github.com/enmanuel/agents/tools"
)
// NewCurrentTime creates a current_time tool that returns the current date and time.
// Useful for agents that need temporal awareness.
func NewCurrentTime() tools.Tool {
return tools.Tool{
Def: tools.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: []tools.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) tools.Result {
layout := tools.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 tools.Result{Output: output}
},
}
}