GnistAI GnistAI
Log in

Getting Started with Nager.Date (Holidays)

Public holidays by country and year — dates, names, and types.

All Tutorials   |   Overview   |   Playground   |   MCP   |   REST API   |   Home
Reference

Data source: Nager.Date

Overview

Nager.Date (Holidays) wraps Nager.Date, handling authentication, pagination, and rate limits for you. This tutorial covers all 5 tools with working code examples you can copy and run.

Prerequisites

  1. Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
  2. Choose your integration method: MCP protocol or REST API.

Connect via MCP

Add to your MCP client config (Claude Desktop, Cursor, etc.):

MCP Config
{
  "mcpServers": {
    "gnist-nager-date": {
      "url": "https://context.gnist.ai/mcp/nager-date/",
      "headers": {
        "Gnist-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Tools (5)

check_holiday

Check whether a given date is a public holiday in a country. Args: date: Date to check in ISO 8601 format (YYYY-MM-DD). country_code: ISO 3166-1 alpha-2 country code (e.g. 'NO', 'US', 'DE'). region_code: Optional ISO 3166-2 region code (e.g. 'US-CA', 'DE-BY'). Returns: Dictionary with is_holiday (bool) and holiday_names (list of matching names).

ParameterTypeRequiredDescription
datestringrequiredDate to check in ISO 8601 format (YYYY-MM-DD).
country_codestringrequiredISO 3166-1 alpha-2 country code (e.g. 'NO', 'US', 'DE').
region_codeanyoptionalOptional ISO 3166-2 region code (e.g. 'US-CA', 'DE-BY').
curl -X POST "https://context.gnist.ai/mcp/nager-date/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "check_holiday", "arguments": {"date": "2025-01-15", "country_code": "'NO'"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/nager-date/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'country_code': "'NO'", 'date': '2025-01-15'},
            'name': 'check_holiday'}},
)
print(resp.json())

list_public_holidays

List all public holidays for a country in a given year. Args: country_code: ISO 3166-1 alpha-2 country code (e.g. 'NO', 'US', 'DE'). year: The year (e.g. 2026). Returns: Dictionary with count and holidays list. Each holiday has date, name, local_name, global flag, counties, and types.

ParameterTypeRequiredDescription
country_codestringrequiredISO 3166-1 alpha-2 country code (e.g. 'NO', 'US', 'DE').
yearintegerrequiredThe year (e.g. 2026).
curl -X POST "https://context.gnist.ai/mcp/nager-date/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "list_public_holidays", "arguments": {"country_code": "'NO'", "year": 2026}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/nager-date/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'country_code': "'NO'", 'year': 2026},
            'name': 'list_public_holidays'}},
)
print(resp.json())

get_next_business_day

Find the next business day on or after a given date, skipping weekends and holidays. Args: date: Starting date in ISO 8601 format (YYYY-MM-DD). country_code: ISO 3166-1 alpha-2 country code (e.g. 'NO', 'US', 'DE'). Returns: Dictionary with next_business_day date and days_skipped count.

ParameterTypeRequiredDescription
datestringrequiredStarting date in ISO 8601 format (YYYY-MM-DD).
country_codestringrequiredISO 3166-1 alpha-2 country code (e.g. 'NO', 'US', 'DE').
curl -X POST "https://context.gnist.ai/mcp/nager-date/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_next_business_day", "arguments": {"date": "2025-01-15", "country_code": "'NO'"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/nager-date/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'country_code': "'NO'", 'date': '2025-01-15'},
            'name': 'get_next_business_day'}},
)
print(resp.json())

count_business_days

Count business days between two dates (inclusive of start, exclusive of end). Args: start_date: Start date in ISO 8601 format (YYYY-MM-DD). end_date: End date in ISO 8601 format (YYYY-MM-DD). Not included in the count. country_code: ISO 3166-1 alpha-2 country code (e.g. 'NO', 'US', 'DE'). Returns: Dictionary with business_days count and calendar_days in the range.

ParameterTypeRequiredDescription
start_datestringrequiredStart date in ISO 8601 format (YYYY-MM-DD).
end_datestringrequiredEnd date in ISO 8601 format (YYYY-MM-DD). Not included in the count.
country_codestringrequiredISO 3166-1 alpha-2 country code (e.g. 'NO', 'US', 'DE').
curl -X POST "https://context.gnist.ai/mcp/nager-date/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "count_business_days", "arguments": {"start_date": "2025-01-15", "end_date": "2025-01-15", "country_code": "'NO'"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/nager-date/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'country_code': "'NO'",
                          'end_date': '2025-01-15',
                          'start_date': '2025-01-15'},
            'name': 'count_business_days'}},
)
print(resp.json())

report_feedback

Report a bug, feature request, or general feedback for this data source. Use this when something doesn't work as expected, when you'd like a new feature, or when you have suggestions for improvement. Args: feedback: Describe the issue or suggestion. feedback_type: One of 'bug', 'feature_request', or 'general'.

ParameterTypeRequiredDescription
feedbackstringrequired
feedback_typestringoptional (default: general)
curl -X POST "https://context.gnist.ai/mcp/nager-date/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "report_feedback", "arguments": {"feedback": "example"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/nager-date/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'feedback': 'example'}, 'name': 'report_feedback'}},
)
print(resp.json())

Common Patterns

Search then retrieve
Use list_public_holidays to find items, then get_next_business_day to get full details. This two-step pattern is common for exploring data before drilling down.
Date range filtering
Use date range parameters to narrow results to a specific time window. Dates are typically in YYYY-MM-DD format.

FAQ

What data does Nager.Date (Holidays) provide?

Public holidays by country and year — dates, names, and types. It exposes 5 tools: check_holiday, list_public_holidays, get_next_business_day, count_business_days, report_feedback.

What do I need to get started?

A Gnist API key (free tier: 100 calls/day). Sign up at https://context.gnist.ai/signup.

What format does the Nager.Date (Holidays) API return?

JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.

Next Steps

Related Tutorials