Skip to content

Commit 2ab3b37

Browse files
committed
- - -
1 parent 0cc7914 commit 2ab3b37

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/tools/Time.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Tool, ToolOptions } from "..";
2+
3+
export default class TimeTool extends Tool {
4+
constructor(options: Omit<ToolOptions, "func">) {
5+
super("get_time", {
6+
...options,
7+
description: "Get the current time from the system",
8+
parameters: {
9+
timeZone:
10+
"Optional - Time zone to get the time from, if not provided, the time zone of the system will be used",
11+
},
12+
func: (args: { timeZone: string }) => {
13+
args.timeZone ||= new Date().toString().split(" ")[5];
14+
return new Date().toLocaleString("en-US", { timeZone: args.timeZone });
15+
},
16+
});
17+
}
18+
}

0 commit comments

Comments
 (0)