Skip to main content
Glama
niondigital

MoCo MCP Server

by niondigital

get_public_holidays

Retrieve public holidays for any year from 2000 to 2100 with daily details and total count calculations.

Instructions

Get all public holidays for a specific year with daily breakdown and total calculations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearYesYear to retrieve public holidays for (e.g., 2024)

Implementation Reference

  • The complete tool definition for 'get_public_holidays' including the handler function that validates input, fetches data from Moco API, handles empty results and errors, and formats the output.
    export const getPublicHolidaysTool = {
      name: 'get_public_holidays',
      description: 'Get all public holidays for a specific year with daily breakdown and total calculations',
      inputSchema: zodToJsonSchema(GetPublicHolidaysSchema),
      handler: async (params: z.infer<typeof GetPublicHolidaysSchema>): Promise<string> => {
        const { year } = params;
    
        // Validate year parameter
        if (!Number.isInteger(year) || year < 2000 || year > 2100) {
          return createValidationErrorMessage({
            field: 'year',
            value: year,
            reason: 'invalid_year_range'
          });
        }
    
        try {
          const apiService = new MocoApiService();
          const publicHolidays = await apiService.getPublicHolidays(year);
    
          if (publicHolidays.length === 0) {
            return createEmptyResultMessage({
              type: 'public_holidays',
              year
            });
          }
    
          return formatPublicHolidaysSummary(publicHolidays, year);
    
        } catch (error) {
          return `Error retrieving public holidays for ${year}: ${error instanceof Error ? error.message : 'Unknown error'}`;
        }
      }
    };
  • Zod schema defining the input for the get_public_holidays tool: a year parameter between 2000 and 2100.
    // Schema for get_public_holidays tool
    const GetPublicHolidaysSchema = z.object({
      year: z.number().int().min(2000).max(2100).describe('Year to retrieve public holidays for (e.g., 2024)')
    });
  • src/index.ts:34-42 (registration)
    Registration of getPublicHolidaysTool in the AVAILABLE_TOOLS array used by the MCP server for tool listing and execution dispatching.
    const AVAILABLE_TOOLS = [
      getActivitiesTool,
      getUserProjectsTool,
      getUserProjectTasksTool,
      getUserHolidaysTool,
      getUserPresencesTool,
      getUserSickDaysTool,
      getPublicHolidaysTool
    ];
  • MocoApiService method that fetches all schedules for the year and filters for public holidays (assignment code '2'). Called by the tool handler.
    async getPublicHolidays(year: number): Promise<any[]> {
      // Calculate year date range
      const startDate = `${year}-01-01`;
      const endDate = `${year}-12-31`;
      
      try {
        // Get ALL schedules using direct request
        const allSchedules = await this.makeRequest<any[]>('/schedules', {
          from: startDate,
          to: endDate
        });
        
        // Filter for public holidays (assignment code "2" and type "Absence")
        const publicHolidays = allSchedules.filter(schedule => 
          schedule.assignment && 
          schedule.assignment.type === 'Absence' &&
          schedule.assignment.code === '2'
        );
        
        return publicHolidays;
      } catch (error) {
        console.error('DEBUG API: Error fetching public holidays:', error);
        return [];
      }
    }
  • Helper function called by the handler to format the public holidays data into a readable summary with dates, totals, and approximate working days calculation.
    function formatPublicHolidaysSummary(holidays: any[], year: number): string {
      const lines: string[] = [];
      
      lines.push(`Public holidays for ${year}:`);
      lines.push('');
    
      if (holidays.length > 0) {
        // Sort holidays by date
        const sortedHolidays = holidays.sort((a, b) => a.date.localeCompare(b.date));
        
        lines.push('Holiday dates:');
        sortedHolidays.forEach(holiday => {
          const holidayName = holiday.assignment?.name || 'Public Holiday';
          const date = holiday.date;
          lines.push(`- ${date}: ${holidayName}`);
        });
        lines.push('');
      }
    
      // Summary statistics
      lines.push('Summary:');
      lines.push(`- Total public holidays: ${holidays.length} days`);
      
      // Calculate remaining working days (rough estimate: 365 - weekends - holidays)
      const totalDaysInYear = isLeapYear(year) ? 366 : 365;
      const approximateWeekends = Math.floor(totalDaysInYear / 7) * 2;
      const approximateWorkingDays = totalDaysInYear - approximateWeekends - holidays.length;
      
      lines.push(`- Approximate working days: ${approximateWorkingDays} days`);
    
      return lines.join('\\n');
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions output details ('daily breakdown and total calculations'), which adds some behavioral context beyond basic retrieval. However, it lacks critical information like whether this is a read-only operation, potential rate limits, authentication requirements, or data source specifics, leaving significant gaps 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 a single, efficient sentence that front-loads the core purpose ('Get all public holidays for a specific year') and adds valuable output details without redundancy. Every word earns its place, making it appropriately sized and well-structured for quick comprehension.

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

Completeness3/5

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

Given the tool's low complexity (1 parameter, no nested objects) and high schema coverage, the description is minimally adequate. However, with no annotations and no output schema, it should provide more behavioral context (e.g., read-only nature, response format). The mention of 'daily breakdown and total calculations' helps but doesn't fully compensate for the lack of structured data.

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 description coverage is 100%, with the 'year' parameter fully documented in the schema (type, range, example). The description adds no additional parameter semantics beyond implying the year is used for retrieval. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate but doesn't detract either.

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

Purpose4/5

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

The description clearly states the verb ('Get') and resource ('public holidays'), specifying the scope ('for a specific year') and output details ('daily breakdown and total calculations'). It distinguishes from sibling tools like 'get_user_holidays' by focusing on public rather than user-specific holidays. However, it doesn't explicitly contrast with all siblings, so it's not a perfect 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, exclusions, or compare it to sibling tools like 'get_user_holidays' for personal vs. public data. Without such context, an agent must infer usage from the tool name alone.

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/niondigital/moco-mcp'

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