Files
2025-06-02 13:50:28 +05:30

30 lines
811 B
TypeScript

import { tool } from "@langchain/core/tools";
import {
getLighthouseResourceById,
getLighthouseResources,
} from "@/actions/lighthouse/resources";
import { getResourceSchema, getResourcesSchema } from "@/types/lighthouse";
export const getResourcesTool = tool(
async ({ page, query, sort, filters, fields }) => {
return await getLighthouseResources(page, query, sort, filters, fields);
},
{
name: "getResources",
description: "Fetches all resource information",
schema: getResourcesSchema,
},
);
export const getResourceTool = tool(
async ({ id, fields, include }) => {
return await getLighthouseResourceById(id, fields, include);
},
{
name: "getResource",
description: "Fetches information about a resource by its UUID.",
schema: getResourceSchema,
},
);