From e25fc39bac8ae472b6f99393423778adc2edd3d7 Mon Sep 17 00:00:00 2001 From: Gregor Lohaus Date: Tue, 31 Mar 2026 14:23:04 +0200 Subject: [PATCH] current time tool --- src/app/api/chat/route.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/api/chat/route.ts b/src/app/api/chat/route.ts index f455202..0924b08 100644 --- a/src/app/api/chat/route.ts +++ b/src/app/api/chat/route.ts @@ -1,7 +1,7 @@ import { auth } from '@clerk/nextjs/server' import { createOpenAI } from '@ai-sdk/openai' import { streamText, tool, convertToModelMessages, stepCountIs, type UIMessage } from 'ai' -import { z } from 'zod' +import { success, z } from 'zod' import { eq, and } from 'drizzle-orm' import { env } from '~/env' import { db } from '~/server/db' @@ -74,6 +74,11 @@ export async function POST(req: Request) { }), execute: async (input) => scheduleMeeting({ ...input, userId }), }), + getCurrentUnixTime: tool({ + description: 'Get the current unix time to reference for meeting dates', + inputSchema: z.undefined(), + execute: async () => { return {success: true, currentTime: Date.now()} } + }) }, stopWhen: stepCountIs(5), onFinish: async ({ text, finishReason }) => {