Skip to main content
Glama
alanpcf

brasil-data-mcp

consultar_feriados

Find Brazilian national holidays for any year between 1900 and 2199. Get dates, names, and types (national/optional) for holiday planning and business day calculations.

Instructions

Lista os feriados NACIONAIS brasileiros de um ano específico via BrasilAPI. Retorna em JSON um array com data (YYYY-MM-DD), nome do feriado e tipo (national/optional). Inclui feriados móveis calculados (Carnaval, Páscoa, Corpus Christi). Use quando o usuário perguntar quando cai um feriado, listar feriados do ano, planejar emendas/pontes, ou calcular dias úteis. NÃO use para: feriados estaduais ou municipais (a API só cobre nacionais), datas comemorativas sem dia de folga (Dia das Mães etc.), ou anos fora da faixa 1900-2199.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
anoYesAno dos feriados, 4 dígitos. Faixa aceita: 1900 a 2199. Ex: 2026.

Implementation Reference

  • Handler function that validates the year (1900-2199), calls BrasilAPI /feriados/v1/{ano}, and returns the result with error translation.
    export async function consultarFeriadosHandler(
      input: ConsultarFeriadosInput,
    ): Promise<CallToolResult> {
      if (!validarAno(input.ano)) {
        return {
          content: [
            {
              type: "text",
              text: `Ano inválido: ${input.ano}. Deve ser inteiro entre 1900 e 2199.`,
            },
          ],
          isError: true,
        };
      }
    
      try {
        const dados = await brasilApi.get<unknown>(`/feriados/v1/${input.ano}`);
        return {
          content: [{ type: "text", text: JSON.stringify(dados, null, 2) }],
        };
      } catch (err) {
        return {
          content: [
            {
              type: "text",
              text: traduzirErroBrasilApi(err, {
                notFound: `Feriados de ${input.ano} não encontrados na base.`,
                contextoErro: "Erro ao consultar feriados",
              }),
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema defining the input: a single integer field 'ano' (year) with description.
    export const consultarFeriadosSchema = z.object({
      ano: z
        .number()
        .int()
        .describe(
          "Ano dos feriados, 4 dígitos. Faixa aceita: 1900 a 2199. Ex: 2026.",
        ),
    });
  • src/index.ts:117-124 (registration)
    Registration of the tool with the MCP server, binding tool name, description, schema, and wrapped handler.
    server.registerTool(
      consultarFeriadosTool.name,
      {
        description: consultarFeriadosTool.description,
        inputSchema: consultarFeriadosSchema.shape,
      },
      wrapHandler(consultarFeriadosTool.name, consultarFeriadosHandler),
    );
  • Tool definition object with name 'consultar_feriados', description, and schema reference.
    export const consultarFeriadosTool = {
      name: "consultar_feriados",
      description: [
        "Lista os feriados NACIONAIS brasileiros de um ano específico via BrasilAPI.",
        "",
        "Retorna em JSON um array com data (YYYY-MM-DD), nome do feriado e tipo (national/optional). Inclui feriados móveis calculados (Carnaval, Páscoa, Corpus Christi).",
        "",
        "Use quando o usuário perguntar quando cai um feriado, listar feriados do ano, planejar emendas/pontes, ou calcular dias úteis.",
        "",
        "NÃO use para: feriados estaduais ou municipais (a API só cobre nacionais), datas comemorativas sem dia de folga (Dia das Mães etc.), ou anos fora da faixa 1900-2199.",
      ].join(" "),
      inputSchema: consultarFeriadosSchema,
    };
  • Helper function that validates the year is an integer between 1900 and 2199 (BrasilAPI range).
    function validarAno(ano: number): boolean {
      // Faixa que a BrasilAPI suporta. Validamos local pra evitar round-trip.
      return Number.isInteger(ano) && ano >= 1900 && ano <= 2199;
    }
Behavior4/5

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

No annotations provided, so description carries full burden. Discloses API source (BrasilAPI), return format (JSON array with data, nome, tipo), and inclusion of mobile holidays (Carnaval, Páscoa, Corpus Christi). Could mention error handling or rate limits but sufficient for a simple read-only tool.

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: purpose, return details, usage guidelines. No wasted words, front-loaded with core function. Well-structured.

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

Completeness5/5

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

Single parameter with full documentation, no output schema needed given description of return format. Siblings unrelated, so no cross-tool guidance needed. Complete and self-contained.

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

Parameters4/5

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

Schema already describes 'ano' parameter with range. Description adds context by reiterating the year range and that it's for national holidays. With 100% schema coverage, baseline is 3; the extra context justifies a 4.

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?

Specific verb 'lista' and resource 'feriados NACIONAIS brasileiros' clearly state the tool's purpose. Distinguishes from sibling tools (bancos, cep, cnpj) that cover different domains.

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

Usage Guidelines5/5

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

Explicit use cases provided ('perguntar quando cai um feriado, listar feriados do ano, planejar emendas/pontes, ou calcular dias úteis') and explicit exclusions ('NÃO use para: feriados estaduais ou municipais, datas comemorativas sem dia de folga, anos fora 1900-2199').

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/alanpcf/brasil-data-mcp'

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