Skip to main content
Glama
feriadosapi

feriadosapi

by feriadosapi

Feriados por Estado

feriados_por_estado

Retrieve all national and state holidays for a Brazilian state using its UF abbreviation. Optional parameters include year, facultative holidays, and banking holidays (FEBRABAN).

Instructions

Lista todos os feriados de um estado brasileiro (feriados nacionais + estaduais daquele UF). Use quando o usuário perguntar sobre feriados em um estado específico, como "feriados em São Paulo" ou "feriados do RJ". As siglas dos estados (UF) são: AC, AL, AP, AM, BA, CE, DF, ES, GO, MA, MT, MS, MG, PA, PB, PR, PE, PI, RJ, RN, RS, RO, RR, SC, SP, SE, TO.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ufYesSigla do estado em maiúsculas (ex: SP, RJ, MG, BA)
anoNoAno com 4 dígitos (ex: 2026)
facultativosNoSe true, inclui feriados facultativos do estado
bancariosNoSe true, retorna apenas feriados bancários (calendário FEBRABAN)

Implementation Reference

  • Registration of the 'feriados_por_estado' tool on the MCP server using server.registerTool().
        // 3. feriados_por_estado
        server.registerTool(
            "feriados_por_estado",
            {
                title: "Feriados por Estado",
                description: `Lista todos os feriados de um estado brasileiro (feriados nacionais + estaduais daquele UF).
    Use quando o usuário perguntar sobre feriados em um estado específico, como "feriados em São Paulo" ou "feriados do RJ".
    As siglas dos estados (UF) são: AC, AL, AP, AM, BA, CE, DF, ES, GO, MA, MT, MS, MG, PA, PB, PR, PE, PI, RJ, RN, RS, RO, RR, SC, SP, SE, TO.`,
                inputSchema: z.object({
                    uf: z
                        .string()
                        .length(2)
                        .describe("Sigla do estado em maiúsculas (ex: SP, RJ, MG, BA)"),
                    ano: z
                        .string()
                        .optional()
                        .describe("Ano com 4 dígitos (ex: 2026)"),
                    facultativos: z
                        .boolean()
                        .optional()
                        .describe("Se true, inclui feriados facultativos do estado"),
                    bancarios: z
                        .boolean()
                        .optional()
                        .describe("Se true, retorna apenas feriados bancários (calendário FEBRABAN)"),
                }),
            },
            async ({ uf, ano, facultativos, bancarios }) => {
                try {
                    const data = await feriadosApi<{
                        uf: string;
                        feriados: unknown[];
                        meta: unknown;
                    }>({
                        path: `/feriados/estado/${uf.toUpperCase()}`,
                        params: {
                            ano,
                            facultativos: facultativos ? "true" : undefined,
                            bancarios: bancarios ? "true" : undefined,
                        },
                    });
    
                    let header = `📍 Feriados — ${data.uf}`;
                    if (ano) header += ` — ${ano}`;
    
                    const text =
                        header +
                        "\n\n" +
                        formatHolidayList(data.feriados) +
                        formatMeta(data.meta);
                    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,
                    };
                }
            }
        );
  • Input schema definition for 'feriados_por_estado' using Zod: requires 'uf' (2-letter string), optional 'ano', 'facultativos', 'bancarios'.
    inputSchema: z.object({
        uf: z
            .string()
            .length(2)
            .describe("Sigla do estado em maiúsculas (ex: SP, RJ, MG, BA)"),
        ano: z
            .string()
            .optional()
            .describe("Ano com 4 dígitos (ex: 2026)"),
        facultativos: z
            .boolean()
            .optional()
            .describe("Se true, inclui feriados facultativos do estado"),
        bancarios: z
            .boolean()
            .optional()
            .describe("Se true, retorna apenas feriados bancários (calendário FEBRABAN)"),
    }),
  • Handler function that calls feriadosApi at path /feriados/estado/{uf}, formats the response with header, holiday list, and metadata.
        async ({ uf, ano, facultativos, bancarios }) => {
            try {
                const data = await feriadosApi<{
                    uf: string;
                    feriados: unknown[];
                    meta: unknown;
                }>({
                    path: `/feriados/estado/${uf.toUpperCase()}`,
                    params: {
                        ano,
                        facultativos: facultativos ? "true" : undefined,
                        bancarios: bancarios ? "true" : undefined,
                    },
                });
    
                let header = `📍 Feriados — ${data.uf}`;
                if (ano) header += ` — ${ano}`;
    
                const text =
                    header +
                    "\n\n" +
                    formatHolidayList(data.feriados) +
                    formatMeta(data.meta);
                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,
                };
            }
        }
    );
  • Generic API client (feriadosApi) used by the handler to make HTTP requests to the Feriados API.
    export async function feriadosApi<T>(options: ApiRequestOptions): Promise<T> {
        const apiKey = options.apiKey || process.env.FERIADOS_API_KEY;
    
        if (!apiKey) {
            throw new Error(
                "API Key não fornecida. Passe sua chave via parâmetro apiKey na URL ou configure FERIADOS_API_KEY. Obtenha uma gratuita em https://feriadosapi.com/dashboard"
            );
        }
    
        const url = new URL(`${BASE_URL}/api/v1${options.path}`);
    
        // Adiciona query params (ignora undefined)
        if (options.params) {
            Object.entries(options.params).forEach(([key, value]) => {
                if (value !== undefined) {
                    url.searchParams.set(key, value);
                }
            });
        }
    
        const response = await fetch(url.toString(), {
            headers: {
                "X-API-Key": apiKey,
                "Content-Type": "application/json",
            },
        });
    
        if (!response.ok) {
            const errorBody = await response.json().catch(() => ({}));
            const errorMessage =
                errorBody.error || errorBody.message || response.statusText;
    
            switch (response.status) {
                case 401:
                    throw new Error(
                        "API Key inválida ou ausente. Verifique sua chave em https://feriadosapi.com/dashboard"
                    );
                case 403:
                    throw new Error(`Acesso negado: ${errorMessage}`);
                case 429:
                    throw new Error(
                        "Limite de requisições excedido. Plano Gratuito: 60 req/min. Para aumentar o limite, faça upgrade em https://feriadosapi.com/dashboard"
                    );
                case 404:
                    throw new Error(`Recurso não encontrado: ${errorMessage}`);
                default:
                    throw new Error(`Erro na API (${response.status}): ${errorMessage}`);
            }
        }
    
        return response.json() as Promise<T>;
    }
  • Helper function formatHolidayList used to format the holiday list for display.
    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");
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so the description must provide behavioral context. It describes the tool as listing (read operation), but does not disclose behavior for invalid inputs, return format, or performance implications. This is adequate but minimal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, front-loaded with the main purpose, no redundant words. Every sentence adds value: purpose, usage guidance, and list of UFs.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the tool's scope and all input parameters. There is no output schema, but the return type (list of holidays) is evident from the purpose. It is complete for a simple listing tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description provides the full list of UFs and explains 'ano' as a 4-digit year, but the schema already specifies minLength/maxLength. It does not add significant semantics beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states it lists all holidays (national + state) for a Brazilian state, which is specific and clear. It distinguishes itself from sibling tools that focus on national, city, or bank holidays.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly says to use when the user asks about holidays in a specific state and gives examples. It also lists all state abbreviations, providing clear context. It does not explicitly mention when not to use, but sibling names imply alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/feriadosapi/feriadosapi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server