dist / toolsProvider.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toolsProvider = toolsProvider;
const sdk_1 = require("@lmstudio/sdk");
const TIMEZONE = Intl.DateTimeFormat().resolvedOptions().timeZone;
async function toolsProvider(_ctl) {
const tools = [];
const datetimeTool = (0, sdk_1.tool)({
name: "get_current_datetime",
description: "Returns the current local date, time, day of the week, and timezone. " +
"Call this whenever the user asks about the current date, time, day, " +
"or anything time-sensitive.",
parameters: {},
implementation: async () => {
const now = new Date();
const opts = { timeZone: TIMEZONE };
const date = now.toLocaleDateString("en-US", {
...opts,
weekday: "long",
year: "numeric",
month: "long",
day: "numeric",
});
const time = now.toLocaleTimeString("en-US", {
...opts,
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
timeZoneName: "short",
});
return `${date} at ${time}`;
},
});
tools.push(datetimeTool);
return tools;
}