From 8736e217a366dd89680213d05c5729b9ae09377f Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Mon, 16 Sep 2024 10:58:27 +0200 Subject: [PATCH] feat(tool): update open meteo schema --- src/tools/weather/openMeteo.ts | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/tools/weather/openMeteo.ts b/src/tools/weather/openMeteo.ts index 189f33d..296d92b 100644 --- a/src/tools/weather/openMeteo.ts +++ b/src/tools/weather/openMeteo.ts @@ -67,27 +67,25 @@ export class OpenMeteoTool extends Tool< inputSchema() { return z .object({ - location: z - .object({ - latitude: z.number(), - longitude: z.number(), - }) - .strip() - .or( - z - .object({ - name: z.string().min(1), - language: z.string().default("English"), - }) - .strip(), - ), + location: z.union([ + z + .object({ + name: z.string().min(1), + language: z.string().default("English"), + }) + .strip(), + z + .object({ + latitude: z.number(), + longitude: z.number(), + }) + .strip(), + ]), start_date: z - .string() - .date() + .union([z.string().date(), z.string().datetime()]) .describe("Start date for the weather forecast in the format YYYY-MM-DD (UTC)"), end_date: z - .string() - .date() + .union([z.string().date(), z.string().datetime()]) .describe("End date for the weather forecast in the format YYYY-MM-DD (UTC)") .optional(), elevation: z.number().nullish(),