Open History to see the last commit
1import { tool } from "ai";
2import { z } from "zod";
3
4import motorcycles from "@/data/motorcycles";
5
6const getMotorcycles = tool({
7 description: "Get all motorcycles from the database",
8 parameters: z.object({}),
9 execute: async () => {
10 return Promise.resolve(motorcycles);
11 },
12});
13
14const recommendMotorcycle = tool({
15 description: "Use this tool to recommend a motorcycle to the user",
16 parameters: z.object({
17 id: z.string().describe("The id of the motorcycle to recommend"),
18 }),
19});
20
21export default async function getTools() {
22 return {
23 getMotorcycles,
24 recommendMotorcycle,
25 };
26}