Skip to main content
Glama
iMark21

AEAT MCP Server

by iMark21

get_fiscal_calendar

Retrieve Spanish tax filing deadlines for specific years, quarters, or tax forms to ensure compliance with AEAT requirements.

Instructions

Returns Spanish AEAT fiscal calendar deadlines for a given year. Filter by quarter (1-4) to see only that quarter's deadlines. Filter by modelo (e.g., '303', '100') to see deadlines for a specific tax form. Each deadline includes start/end dates, description, and who must file. Source: AEAT Calendario del Contribuyente.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearYesYear (2024-2026)
quarterNoFilter by quarter (1=Jan-Mar, 2=Apr-Jun, 3=Jul-Sep, 4=Oct-Dec)
modeloNoFilter by tax form number (e.g., '303', '100', '720')

Implementation Reference

  • The logic handler for the `get_fiscal_calendar` tool. It processes the input parameters, fetches data, applies filters, and returns the formatted response.
    async ({ year, quarter, modelo }) => {
      const data = loadData(year);
      if (!data) {
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                error: "no_data",
                message: `No fiscal calendar data for year ${year}. Available: 2026.`,
              }),
            },
          ],
        };
      }
    
      let deadlines = data.deadlines;
    
      if (quarter) {
        const quarterMonths: Record<number, number[]> = {
          1: [1, 2, 3],
          2: [4, 5, 6],
          3: [7, 8, 9],
          4: [10, 11, 12],
        };
        const months = quarterMonths[quarter];
        deadlines = deadlines.filter((d: any) => {
          const month = parseInt(d.date_end.split("-")[1], 10);
          return months.includes(month);
        });
      }
    
      if (modelo) {
        deadlines = deadlines.filter(
          (d: any) => d.modelo === modelo
        );
      }
    
      // Find next upcoming deadline
      const today = new Date().toISOString().split("T")[0];
      const nextDeadline = deadlines.find(
        (d: any) => d.date_end >= today
      );
    
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(
              {
                year,
                filters: { quarter: quarter ?? "all", modelo: modelo ?? "all" },
                total_deadlines: deadlines.length,
                next_deadline: nextDeadline ?? null,
                deadlines,
                verified_date: data.verified_date,
                disclaimer:
                  "Informational only. Does not constitute tax advice.",
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • The schema definition (Zod) for the inputs of the `get_fiscal_calendar` tool.
    {
      year: z
        .number()
        .int()
        .min(2024)
        .max(2026)
        .describe("Year (2024-2026)"),
      quarter: z
        .number()
        .int()
        .min(1)
        .max(4)
        .optional()
        .describe("Filter by quarter (1=Jan-Mar, 2=Apr-Jun, 3=Jul-Sep, 4=Oct-Dec)"),
      modelo: z
        .string()
        .optional()
        .describe("Filter by tax form number (e.g., '303', '100', '720')"),
    },
  • The registration function for the `get_fiscal_calendar` tool on the MCP server.
    export function registerFiscalCalendarTool(server: McpServer) {
      server.tool(
        "get_fiscal_calendar",
        "Returns Spanish AEAT fiscal calendar deadlines for a given year. " +
          "Filter by quarter (1-4) to see only that quarter's deadlines. " +
          "Filter by modelo (e.g., '303', '100') to see deadlines for a specific tax form. " +
          "Each deadline includes start/end dates, description, and who must file. " +
          "Source: AEAT Calendario del Contribuyente.",
        {
          year: z
            .number()
            .int()
            .min(2024)
            .max(2026)
            .describe("Year (2024-2026)"),
          quarter: z
            .number()
            .int()
            .min(1)
            .max(4)
            .optional()
            .describe("Filter by quarter (1=Jan-Mar, 2=Apr-Jun, 3=Jul-Sep, 4=Oct-Dec)"),
          modelo: z
            .string()
            .optional()
            .describe("Filter by tax form number (e.g., '303', '100', '720')"),
        },
        async ({ year, quarter, modelo }) => {
          const data = loadData(year);
          if (!data) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: JSON.stringify({
                    error: "no_data",
                    message: `No fiscal calendar data for year ${year}. Available: 2026.`,
                  }),
                },
              ],
            };
          }
    
          let deadlines = data.deadlines;
    
          if (quarter) {
            const quarterMonths: Record<number, number[]> = {
              1: [1, 2, 3],
              2: [4, 5, 6],
              3: [7, 8, 9],
              4: [10, 11, 12],
            };
            const months = quarterMonths[quarter];
            deadlines = deadlines.filter((d: any) => {
              const month = parseInt(d.date_end.split("-")[1], 10);
              return months.includes(month);
            });
          }
    
          if (modelo) {
            deadlines = deadlines.filter(
              (d: any) => d.modelo === modelo
            );
          }
    
          // Find next upcoming deadline
          const today = new Date().toISOString().split("T")[0];
          const nextDeadline = deadlines.find(
            (d: any) => d.date_end >= today
          );
    
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(
                  {
                    year,
                    filters: { quarter: quarter ?? "all", modelo: modelo ?? "all" },
                    total_deadlines: deadlines.length,
                    next_deadline: nextDeadline ?? null,
                    deadlines,
                    verified_date: data.verified_date,
                    disclaimer:
                      "Informational only. Does not constitute tax advice.",
                  },
                  null,
                  2
                ),
              },
            ],
          };
        }
      );
    }
  • Helper function to load the fiscal calendar data from a JSON file.
    function loadData(year: number) {
      const path = join(__dirname, "..", "data", "calendar", `${year}.json`);
      try {
        return JSON.parse(readFileSync(path, "utf-8"));
      } catch {
        return null;
      }
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the return content (deadlines with start/end dates, description, and filer info) and data source, which adds useful context. However, it lacks details on permissions, rate limits, or error handling, leaving some behavioral aspects unclear for a tool with no annotation coverage.

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?

The description is front-loaded with the core purpose, followed by filtering options and return details, all in three efficient sentences. Each sentence adds value without redundancy, making it appropriately sized and well-structured for quick understanding.

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?

Given the tool's moderate complexity, no annotations, and no output schema, the description is fairly complete—it explains what the tool does, filtering options, and return content. However, it could improve by detailing the output structure more explicitly or mentioning any limitations, such as year range constraints already in the schema.

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?

The schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds marginal value by mentioning filtering by quarter and tax form, but it does not provide additional semantic details beyond what the schema specifies, such as examples of other tax forms or implications of filtering.

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 clearly states the specific action ('Returns'), resource ('Spanish AEAT fiscal calendar deadlines'), and scope ('for a given year'). It distinguishes itself from sibling tools by focusing on calendar deadlines rather than tax rates, brackets, or other tax-related data, making its purpose unambiguous.

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?

The description provides clear context on when to use this tool—to retrieve fiscal calendar deadlines—and mentions filtering options by quarter or tax form. However, it does not explicitly state when not to use it or name specific alternatives among the sibling tools, such as for non-calendar tax information.

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/iMark21/aeat-mcp'

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