Skip to main content
Glama
josemvelez78

mcp-europe-business

get_next_payment_date

Read-onlyIdempotent

Calculate next valid payment date for European countries, skipping weekends and public holidays. Supports rules like last working day of month for salary payments.

Instructions

Calculates the next valid payment date based on a reference date and a payment rule for a given European country, skipping weekends and national public holidays. Supports rules: 'last_working_day_of_month' (salary payment), 'first_working_day_of_month', 'nth_working_day' (e.g. 5th working day), 'next_working_day' (next business day after reference). Returns { country, reference_date, rule, result_date, notes }. Use when scheduling salary payments, invoice due dates, or any automated payment workflow that must avoid non-working days.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
country_codeYesTwo-letter ISO country code. Example: 'PT', 'DE', 'FR'
reference_dateYesReference date in YYYY-MM-DD format. Example: '2026-01-31'
ruleYesPayment rule to apply.
nNoFor nth_working_day rule: which working day of the month. Example: 5 for 5th working day.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
countryNo
reference_dateNo
ruleNo
result_dateNo
errorNo

Implementation Reference

  • index.js:762-773 (registration)
    Registration of the 'get_next_payment_date' tool using server.registerTool(), defining its description, inputSchema (country_code, reference_date, rule, optional n), outputSchema, and annotations.
    // ── 24. Get Next Payment Date ──
    server.registerTool("get_next_payment_date", {
      description: "Calculates the next valid payment date based on a reference date and a payment rule for a given European country, skipping weekends and national public holidays. Supports rules: 'last_working_day_of_month' (salary payment), 'first_working_day_of_month', 'nth_working_day' (e.g. 5th working day), 'next_working_day' (next business day after reference). Returns { country, reference_date, rule, result_date, notes }. Use when scheduling salary payments, invoice due dates, or any automated payment workflow that must avoid non-working days.",
      inputSchema: {
        country_code: z.string().describe("Two-letter ISO country code. Example: 'PT', 'DE', 'FR'"),
        reference_date: z.string().describe("Reference date in YYYY-MM-DD format. Example: '2026-01-31'"),
        rule: z.enum(["last_working_day_of_month", "first_working_day_of_month", "next_working_day", "nth_working_day"]).describe("Payment rule to apply."),
        n: z.number().optional().describe("For nth_working_day rule: which working day of the month. Example: 5 for 5th working day.")
      },
      outputSchema: { country: z.string().optional(), reference_date: z.string().optional(), rule: z.string().optional(), result_date: z.string().optional(), error: z.string().optional() },
          annotations: { title: "Get Next Payment Date", readOnlyHint: true, idempotentHint: true, openWorldHint: false }
    }, async ({ country_code, reference_date, rule, n }) => {
  • Handler function for get_next_payment_date. Implements four payment rules: last_working_day_of_month, first_working_day_of_month, next_working_day, and nth_working_day, skipping weekends and national holidays for the given European country.
    }, async ({ country_code, reference_date, rule, n }) => {
      const holidaysByCountry = {
        PT: ["01-01","04-25","05-01","06-10","08-15","10-05","11-01","12-01","12-08","12-25"],
        ES: ["01-01","01-06","05-01","08-15","10-12","11-01","12-06","12-08","12-25"],
        FR: ["01-01","05-01","05-08","07-14","08-15","11-01","11-11","12-25"],
        DE: ["01-01","05-01","10-03","12-25","12-26"],
        IT: ["01-01","01-06","04-25","05-01","06-02","08-15","11-01","12-08","12-25","12-26"],
        NL: ["01-01","04-27","05-05","12-25","12-26"],
        BE: ["01-01","05-01","07-21","08-15","11-01","11-11","12-25"],
        UK: ["01-01","12-25","12-26"],
      };
    
      const code = country_code.toUpperCase();
      const fixedHolidays = holidaysByCountry[code] || [];
    
      const isWorkingDay = (date) => {
        const dow = date.getDay();
        const mmdd = `${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
        return dow !== 0 && dow !== 6 && !fixedHolidays.includes(mmdd);
      };
    
      const ref = new Date(reference_date);
      if (isNaN(ref)) return { content: [{ type: "text", text: JSON.stringify({ error: "Invalid date format. Use YYYY-MM-DD" }) }] };
    
      let resultDate;
    
      if (rule === "next_working_day") {
        const d = new Date(ref);
        d.setDate(d.getDate() + 1);
        while (!isWorkingDay(d)) d.setDate(d.getDate() + 1);
        resultDate = d.toISOString().split("T")[0];
      }
    
      if (rule === "last_working_day_of_month") {
        const d = new Date(ref.getFullYear(), ref.getMonth() + 1, 0); // last day of month
        while (!isWorkingDay(d)) d.setDate(d.getDate() - 1);
        resultDate = d.toISOString().split("T")[0];
      }
    
      if (rule === "first_working_day_of_month") {
        const d = new Date(ref.getFullYear(), ref.getMonth(), 1);
        while (!isWorkingDay(d)) d.setDate(d.getDate() + 1);
        resultDate = d.toISOString().split("T")[0];
      }
    
      if (rule === "nth_working_day") {
        if (!n || n < 1) return { content: [{ type: "text", text: JSON.stringify({ error: "For nth_working_day rule, provide n >= 1" }) }] };
        const d = new Date(ref.getFullYear(), ref.getMonth(), 1);
        let count = 0;
        while (count < n) {
          if (isWorkingDay(d)) count++;
          if (count < n) d.setDate(d.getDate() + 1);
        }
        resultDate = d.toISOString().split("T")[0];
      }
    
      return { content: [{ type: "text", text: JSON.stringify({ country: code, reference_date, rule, n: n || null, result_date: resultDate }) }] };
    });
  • Helper data structure holidaysByCountry mapping country codes to arrays of fixed national public holidays (MM-DD format) for PT, ES, FR, DE, IT, NL, BE, UK.
    const holidaysByCountry = {
      PT: ["01-01","04-25","05-01","06-10","08-15","10-05","11-01","12-01","12-08","12-25"],
      ES: ["01-01","01-06","05-01","08-15","10-12","11-01","12-06","12-08","12-25"],
      FR: ["01-01","05-01","05-08","07-14","08-15","11-01","11-11","12-25"],
      DE: ["01-01","05-01","10-03","12-25","12-26"],
      IT: ["01-01","01-06","04-25","05-01","06-02","08-15","11-01","12-08","12-25","12-26"],
      NL: ["01-01","04-27","05-05","12-25","12-26"],
      BE: ["01-01","05-01","07-21","08-15","11-01","11-11","12-25"],
      UK: ["01-01","12-25","12-26"],
    };
  • Helper function isWorkingDay(date) that checks if a date is a working day (not Saturday/Sunday and not a fixed holiday) for the selected country.
    const isWorkingDay = (date) => {
      const dow = date.getDay();
      const mmdd = `${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
      return dow !== 0 && dow !== 6 && !fixedHolidays.includes(mmdd);
    };
  • Input schema definition for get_next_payment_date using Zod: country_code (string), reference_date (string YYYY-MM-DD), rule (enum with four values), and optional n (number for nth_working_day rule).
    inputSchema: {
      country_code: z.string().describe("Two-letter ISO country code. Example: 'PT', 'DE', 'FR'"),
      reference_date: z.string().describe("Reference date in YYYY-MM-DD format. Example: '2026-01-31'"),
      rule: z.enum(["last_working_day_of_month", "first_working_day_of_month", "next_working_day", "nth_working_day"]).describe("Payment rule to apply."),
      n: z.number().optional().describe("For nth_working_day rule: which working day of the month. Example: 5 for 5th working day.")
    },
    outputSchema: { country: z.string().optional(), reference_date: z.string().optional(), rule: z.string().optional(), result_date: z.string().optional(), error: z.string().optional() },
Behavior5/5

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

Annotations declare readOnlyHint=true and idempotentHint=true. The description adds details about skipping weekends and public holidays, applicable rules, and return structure, fully disclosing behavior without contradiction.

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: first states core purpose, second lists rules, third gives usage scenarios. No filler; front-loaded with essential information.

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?

The description covers purpose, parameters, rules, return structure (explicitly mentioning fields in returned object), and usage context. With good annotations and full schema, no gaps remain.

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 covers 100% of parameters with descriptions. The description adds examples (e.g., country codes, date format) and explains each rule's meaning, going beyond basic schema info.

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 it calculates the next valid payment date based on a reference date and a rule for a European country. It lists all supported rules and return fields, distinguishing it from sibling tools (e.g., working days or validation tools).

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 explicitly says 'Use when scheduling salary payments, invoice due dates, or any automated payment workflow that must avoid non-working days.' While it does not mention when not to use, the context is clear and no direct alternative exists among siblings.

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/josemvelez78/mcp-europe-business'

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