delete-public-holiday
Archive a public holiday in Float by providing its holiday ID to remove it from the calendar.
Instructions
Delete a public holiday (archives it in Float)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| holiday_id | Yes | The public holiday ID |
Implementation Reference
- The actual handler implementation for delete-public-holiday. It uses createTool to define the tool, accepting holiday_id as input, calling floatApi.delete, and returning a success message.
// Delete public holiday export const deletePublicHoliday = createTool( 'delete-public-holiday', 'Delete a public holiday (archives it in Float)', z.object({ holiday_id: z.union([z.string(), z.number()]).describe('The public holiday ID'), }), async (params) => { await floatApi.delete(`/public-holidays/${params.holiday_id}`); return { success: true, message: 'Public holiday deleted successfully' }; } ); - Input schema for delete-public-holiday: requires holiday_id (string or number).
z.object({ holiday_id: z.union([z.string(), z.number()]).describe('The public holiday ID'), }), - src/tools/index.ts:136-142 (registration)Import of deletePublicHoliday from the public-holidays module into the tools index.
import { listPublicHolidays, getPublicHoliday, createPublicHoliday, updatePublicHoliday, deletePublicHoliday, } from './time-management/public-holidays.js'; - src/tools/index.ts:286-290 (registration)Registration of deletePublicHoliday in the legacyTools array for export.
listPublicHolidays, getPublicHoliday, createPublicHoliday, updatePublicHoliday, deletePublicHoliday, - src/tools/base.ts:50-104 (helper)The createTool helper function that wraps the handler with schema validation and error handling.
export const createTool = <T, P extends z.ZodType>( name: string, description: string, schema: P, handler: (params: z.infer<P>) => Promise<T> ): { name: string; description: string; inputSchema: P; handler: (params: unknown) => Promise<ToolResponse<T>>; } => { return { name, description, inputSchema: schema, handler: async (params: unknown): Promise<ToolResponse<T>> => { try { const validatedParams = schema.parse(params); const result = await handler(validatedParams); // Extract format from params if available const responseFormat = ((validatedParams as Record<string, unknown>).format as ResponseFormat) || 'json'; return { success: true, data: result, format: responseFormat }; } catch (error) { logger.error(`Error in ${name} tool:`, error); // Handle Float API errors with enhanced formatting if (error instanceof FloatApiError) { return FloatErrorHandler.formatErrorForMcp(error) as ToolResponse<T>; } // Handle parameter validation errors if (error instanceof z.ZodError) { return { success: false, error: `Parameter validation failed: ${error.errors.map((e) => `${e.path.join('.')}: ${e.message}`).join(', ')}`, errorCode: 'PARAMETER_VALIDATION_ERROR', details: { validationErrors: error.errors, }, } as ToolResponse<T>; } // Handle other errors return { success: false, error: error instanceof Error ? error.message : 'Unknown error occurred', errorCode: 'UNKNOWN_ERROR', } as ToolResponse<T>; } }, }; };