Skip to main content
Glama
niondigital

MoCo MCP Server

by niondigital

get_user_sick_days

Retrieve all sick days for a specific year with daily breakdown and total calculations from MoCo time tracking systems.

Instructions

Get all user sick days for a specific year with daily breakdown and total calculations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearYesYear to retrieve sick days for (e.g., 2024)

Implementation Reference

  • The handler function that implements the core logic of the get_user_sick_days tool: validates input year, fetches sick days data from Moco API, processes and summarizes the data, handles empty results and errors.
    handler: async (params: z.infer<typeof GetUserSickDaysSchema>): Promise<string> => {
      const { year } = params;
    
      // Validate year
      if (!validateYear(year)) {
        return createValidationErrorMessage({
          field: 'year',
          value: year,
          reason: 'invalid_year'
        });
      }
    
      try {
        const apiService = new MocoApiService();
        const sickDays = await apiService.getTakenSickDays(year);
    
        // Debug logging
        console.error(`DEBUG: Got ${sickDays.length} sick days for year ${year}`);
        console.error('DEBUG: Sick days data:', JSON.stringify(sickDays.slice(0, 3), null, 2));
    
        if (sickDays.length === 0) {
          return formatSickDaysWithNoData(year);
        }
    
        const summary = createSickDaysSummary(sickDays, year);
        console.error('DEBUG: Sick days summary created:', JSON.stringify(summary, null, 2));
        return formatSickDaysSummary(summary);
    
      } catch (error) {
        return `Error retrieving sick days for ${year}: ${error instanceof Error ? error.message : 'Unknown error'}`;
      }
    }
  • Zod schema defining the input parameters for the get_user_sick_days tool, requiring a single 'year' parameter as an integer.
    const GetUserSickDaysSchema = z.object({
      year: z.number().int().describe('Year to retrieve sick days for (e.g., 2024)')
    });
  • src/index.ts:34-42 (registration)
    Registration of the getUserSickDaysTool in the AVAILABLE_TOOLS array used by the MCP server to list and dispatch tools.
    const AVAILABLE_TOOLS = [
      getActivitiesTool,
      getUserProjectsTool,
      getUserProjectTasksTool,
      getUserHolidaysTool,
      getUserPresencesTool,
      getUserSickDaysTool,
      getPublicHolidaysTool
    ];
  • src/index.ts:25-25 (registration)
    Import statement that brings the getUserSickDaysTool into the main index file for registration.
    import { getUserSickDaysTool } from './tools/userSickDaysTools.js';
  • Helper function that processes raw sick days data into a structured HolidaySummary, calculating total days and preparing formatted output.
    function createSickDaysSummary(sickDays: any[], year: number): HolidaySummary {
      console.error('DEBUG: Processing sick days...');
      
      // Process sick days from schedules endpoint
      const processedSickDays = sickDays
        .map(schedule => ({
          date: schedule.date,
          days: calculateDaysFromSchedule(schedule), // Calculate days from am/pm flags
          status: 'sick', // All schedules are sick days
          note: schedule.comment || ''
        }))
        .sort((a, b) => a.date.localeCompare(b.date)); // Sort by date
    
      console.error('DEBUG: Processed sick days:', processedSickDays);
    
      // Calculate totals
      const totalSickDays = processedSickDays.reduce((total, sickDay) => total + sickDay.days, 0);
    
      return {
        year,
        holidays: processedSickDays, // Reuse the same structure
        totalTakenDays: Math.round(totalSickDays * 100) / 100, // Round to 2 decimal places
        annualEntitlementDays: 0, // Not applicable for sick days
        utilizationPercentage: 0, // Not applicable for sick days
        remainingDays: 0 // Not applicable for sick days
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves data with calculations, implying a read-only operation, but doesn't clarify permissions, rate limits, data freshness, or error conditions. For a tool with no annotation coverage, this leaves significant behavioral gaps.

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 and includes key details without waste. Every part of the sentence earns its place by specifying the action, resource, scope, and output characteristics.

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 moderate complexity (retrieving and calculating sick days), lack of annotations, and no output schema, the description is adequate but incomplete. It covers the purpose and output characteristics but misses behavioral details like permissions or error handling. It's minimally viable for a read operation but could be more comprehensive.

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 input schema has 100% description coverage, with the 'year' parameter fully documented. The description adds context by specifying 'for a specific year' and mentioning 'daily breakdown and total calculations', which provides additional meaning about the output structure. However, it doesn't add syntax or format details beyond what the schema already provides.

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 tool's purpose with a specific verb ('Get') and resource ('user sick days'), including scope details ('for a specific year with daily breakdown and total calculations'). It distinguishes from siblings by focusing on sick days rather than activities, holidays, presences, or projects. However, it doesn't explicitly differentiate from similar tools like 'get_user_holidays' beyond the resource name.

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 comparisons with sibling tools like 'get_user_holidays' or 'get_user_presences', leaving the agent to infer usage context solely from the tool name and description.

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