var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
import { tool } from "langchain";
import { z } from "zod";
const getUserLocationSchema = z.object({});
export function createGetUserLocationTool() {
    return tool((_input, runtime) => __awaiter(this, void 0, void 0, function* () {
        const currentPage = runtime.context.currentPage;
        if (!currentPage) {
            return JSON.stringify({
                status: 404,
                message: "Current user location is not available.",
            }, null, 2);
        }
        return JSON.stringify({
            status: 200,
            location: currentPage,
        }, null, 2);
    }), {
        name: "get_user_location",
        description: "Get the user's current location in the AdminForth UI, including current page path, full path, title, and URL. Call this tool when you do not understand what the user is referring to, especially when they say here, this page, current page, opened page, or otherwise rely on page context.",
        schema: getUserLocationSchema,
    });
}
