const myTool = createTool({
name: 'my_tool',
description: 'Tool with nullable enum parameter',
parameters: z.object({
paramA: z.enum(['active', 'inactive', 'pending'])
.nullable()
.describe('The status of the item, or null if not specified'),
paramB: z.string(),
}),
handler: async ({ status, userId }) => {
// status can be null here
if (status === null) {
// Handle null case
}
return { success: true };
},
});
required: [
"paramA",
"paramB"
]