get-feriados-timeframe
Retrieve public holidays for a specific year in Argentina using the MCP Argentina Datos API. Input the desired year to access accurate holiday data.
Instructions
Devuelve los feriados de un año específico pasado por parámetro
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| year | Yes | EJ: 2025 |
Implementation Reference
- main.ts:140-184 (handler)The full handler implementation for the 'get-feriados-timeframe' tool, registered via server.tool. It handles input validation, calls the getFeriados helper with the year parameter, formats the response as JSON, and manages errors.server.tool( "get-feriados-timeframe", "Devuelve los feriados de un año específico pasado por parámetro", { year: z.number().describe("EJ: 2025"), }, async ({ year }) => { if (year === undefined) { return { content: [ { type: "text", text: "No se ha provisto el parámetro 'year'", }, ], }; } try { const data = await getFeriados(year); if (data.length === 0) { return { content: [ { type: "text", text: "No se encontraron feriados para el año especificado", }, ], }; } return { content: [ { type: "text", text: JSON.stringify(data, null, 2), mimeType: "application/json", }, ], }; } catch (error) { return { content: [{ type: "text", text: "Error al obtener los feriados" }], }; } } );
- main.ts:30-36 (schema)Tool schema in the McpServer tools array for discovery, defining name, description, and input parameters schema using Zod.{ name: "get-feriados-timeframe", description: "Devuelve los feriados del año", parameters: { year: z.number().describe("EJ: 2025"), }, },
- utils/functions.ts:2-6 (helper)Core helper function getFeriados that fetches holiday data from the Argentina Datos API for a specific year (or current year by default). This is the actual implementation performing the HTTP request.export const getFeriados = async (year = new Date().getFullYear()) => { const feriados = await fetch(`${BASE_URL}/feriados/${year}`); const data = await feriados.json(); return data; };