creamy-megabyte-39753
10/24/2025, 8:50 PMrefined-appointment-81829
10/27/2025, 3:07 PMbitter-ghost-46918
10/28/2025, 4:05 AMcreamy-megabyte-39753
10/28/2025, 4:09 AM.optional() do you know why? It only supports serializable json schemas.bitter-ghost-46918
10/28/2025, 7:36 AM.optional() should work out of the box for function tools. Yyou can just append it to a field, e.g. z.string().optional().
Could you clarify what you’re trying to achieve?creamy-megabyte-39753
10/28/2025, 12:46 PMexport const weatherTool = llm.tool({
description: `...`,
parameters: z.object({
location: z
.string()
.optional()
.describe('The city or location for weather and activity planning'),
}),
This is the error:
No overload matches this call.
Overload 1 of 2, '({ description, parameters, execute, }: { description: string; parameters?: ToolInputSchema<JSONObject>; execute: ToolExecuteFunction<JSONObject, unknown, unknown>; }): FunctionTool<...>', gave the following error.
Type 'ZodObject<{ location: ZodOptional<ZodString>; }, "strip", ZodTypeAny, { location?: string | undefined; }, { location?: string | undefined; }>' is not assignable to type 'ToolInputSchema<JSONObject>'.
Type 'ZodObject<{ location: ZodOptional<ZodString>; }, "strip", ZodTypeAny, { location?: string | undefined; }, { location?: string | undefined; }>' is not assignable to type 'ZodObject<any, any, any, JSONObject, JSONObject>'.
Type '{ location?: string | undefined; }' is not assignable to type 'JSONObject'.
Property 'location' is incompatible with index signature.
Type 'string | undefined' is not assignable to type 'JSONValue'.
Type 'undefined' is not assignable to type 'JSONValue'.
Overload 2 of 2, '({ id, config, }: { id: string; config: Record<string, unknown>; }): ProviderDefinedTool', gave the following error.
Object literal may only specify known properties, and 'description' does not exist in type '{ id: string; config: Record<string, unknown>; }'.ts(2769)
tool_context.d.ts(106, 5): The expected type comes from property 'parameters' which is declared here on type '{ description: string; parameters?: ToolInputSchema<JSONObject>; execute: ToolExecuteFunction<JSONObject, unknown, unknown>; }'creamy-megabyte-39753
10/28/2025, 12:48 PMexport type JSONValue = null | string | number | boolean | JSONObject | JSONArray;
export type JSONArray = JSONValue[];
export type JSONObject = {
[key: string]: JSONValue;
};
export function tool<
Parameters extends JSONObject = Record<string, never>,
UserData = UnknownUserData,
Result = unknown,
>({creamy-megabyte-39753
10/28/2025, 2:47 PM.optional allows undefined, other AI frameworks like mastra.ai allows optional in zod schemas, because naturally some fields are not required for LLMs, and they need to know, but for some reason Livekit only allows json schemas and undefined is not a valid json value.bitter-ghost-46918
10/28/2025, 3:44 PMbitter-ghost-46918
10/30/2025, 4:01 PMcreamy-megabyte-39753
10/30/2025, 4:03 PM