Verificar se Data é Feriado
verificar_dataVerify if a date is a holiday in Brazil. Get all national, state, and municipal holidays falling on that date. An empty list means it's not a holiday.
Instructions
Verifica se uma data específica é feriado no Brasil. Use quando o usuário perguntar algo como "amanhã é feriado?", "25 de dezembro é feriado?", ou "segunda-feira vai ser feriado?". Retorna todos os feriados que caem naquela data (pode ter mais de um: nacional + municipal, por exemplo). Se retornar lista vazia, a data NÃO é feriado.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Data no formato YYYY-MM-DD (ex: 2026-12-25) |
Implementation Reference
- lib/tools/feriados.ts:311-347 (handler)The async handler function that executes the 'verificar_data' tool logic. It calls the feriados API with the date, checks if any holidays exist, and returns a formatted response indicating whether the date is a holiday or not.
async ({ data: dateStr }) => { try { const data = await feriadosApi<{ data: string; feriados: unknown[]; total: number; }>({ path: `/feriados/data/${dateStr}`, }); if (data.total === 0) { return { content: [ { type: "text" as const, text: `📅 ${data.data} — NÃO é feriado nacional.`, }, ], }; } const text = `📅 ${data.data} — É FERIADO! (${data.total} feriado(s) nesta data)\n\n` + formatHolidayList(data.feriados); return { content: [{ type: "text" as const, text }] }; } catch (error) { return { content: [ { type: "text" as const, text: `❌ Erro: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } } - lib/tools/feriados.ts:305-309 (schema)The input schema for 'verificar_data' using Zod. Defines a required 'data' parameter as a string in YYYY-MM-DD format.
inputSchema: z.object({ data: z .string() .describe("Data no formato YYYY-MM-DD (ex: 2026-12-25)"), }), - lib/tools/feriados.ts:297-348 (registration)Registration of the 'verificar_data' tool using server.registerTool(), including the tool name, metadata (title, description), input schema, and handler function.
server.registerTool( "verificar_data", { title: "Verificar se Data é Feriado", description: `Verifica se uma data específica é feriado no Brasil. Use quando o usuário perguntar algo como "amanhã é feriado?", "25 de dezembro é feriado?", ou "segunda-feira vai ser feriado?". Retorna todos os feriados que caem naquela data (pode ter mais de um: nacional + municipal, por exemplo). Se retornar lista vazia, a data NÃO é feriado.`, inputSchema: z.object({ data: z .string() .describe("Data no formato YYYY-MM-DD (ex: 2026-12-25)"), }), }, async ({ data: dateStr }) => { try { const data = await feriadosApi<{ data: string; feriados: unknown[]; total: number; }>({ path: `/feriados/data/${dateStr}`, }); if (data.total === 0) { return { content: [ { type: "text" as const, text: `📅 ${data.data} — NÃO é feriado nacional.`, }, ], }; } const text = `📅 ${data.data} — É FERIADO! (${data.total} feriado(s) nesta data)\n\n` + formatHolidayList(data.feriados); return { content: [{ type: "text" as const, text }] }; } catch (error) { return { content: [ { type: "text" as const, text: `❌ Erro: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } } ); - lib/tools/feriados.ts:6-17 (helper)Helper function 'formatHolidayList' used by the handler to format the list of holidays into a readable string (with name, type, date, and bank holiday indicator).
function formatHolidayList(feriados: any[]): string { if (!feriados || feriados.length === 0) { return "Nenhum feriado encontrado para os critérios informados."; } return feriados .map( (f) => `📅 ${f.data} — ${f.nome} (${f.tipo})${f.bancario ? " 🏦" : ""}${f.descricao ? `\n ${f.descricao}` : ""}` ) .join("\n\n"); } - src/data/tools.ts:60-69 (schema)Declarative tool metadata entry for 'verificar_data' in the toolDetails array, providing name, icon, title, description, params, and returns information for UI purposes.
{ name: "verificar_data", icon: "📅", title: "Verificar se Data é Feriado", description: "Verifica se uma data específica é feriado. Ideal para \"amanhã é feriado?\" ou \"25/12 é feriado?\".", params: [ { name: "data", type: "string", required: true, desc: "Data no formato YYYY-MM-DD", example: "2026-12-25" }, ], returns: "Se é feriado ou não, com detalhes de todos os feriados naquela data.",