Skip to main content
Glama

audit_period_compliance

Run a multi-day wage-and-hour compliance audit evaluating meal and rest breaks. Returns per-day breakdown and period totals with premium hours owed, days at risk, and flag-count heatmap for payroll review or manager dashboard.

Instructions

Run a wage-and-hour compliance audit across multiple days. For each day, resolves attendance and evaluates meal/rest compliance under the chosen jurisdiction rule pack. Returns per-day breakdown plus period totals: hours of premium owed (meal + rest), days at risk, days with rebuttable-presumption exposure, and a flag-count heatmap. Use this for monthly payroll review, pre-audit triage, or a manager dashboard.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
employeeIdNoOptional employee identifier. Echoed in the report for downstream routing.
jurisdictionYesJurisdiction rule pack. Currently CA only; more arrive in subsequent minor versions.
daysYesOne ResolveDayInput per duty date in the audit window. Order is preserved.
waiversNo

Implementation Reference

  • The core handler function 'registerAuditPeriodCompliance' which registers the 'audit_period_compliance' MCP tool. It accepts employeeId, jurisdiction, days (array of ResolveDayInput), and optional waivers. For each day it calls resolveDay() and evaluateBreakCompliance(), then returns a comprehensive audit report including premium hours, days at risk, presumption risk counts, flag heatmaps, and per-day breakdowns.
    export function registerAuditPeriodCompliance(server: McpServer): void {
      server.tool(
        'audit_period_compliance',
        "Run a wage-and-hour compliance audit across multiple days. For each day, resolves attendance and evaluates meal/rest compliance under the chosen jurisdiction rule pack. Returns per-day breakdown plus period totals: hours of premium owed (meal + rest), days at risk, days with rebuttable-presumption exposure, and a flag-count heatmap. Use this for monthly payroll review, pre-audit triage, or a manager dashboard.",
        {
          employeeId: z
            .string()
            .optional()
            .describe('Optional employee identifier. Echoed in the report for downstream routing.'),
          jurisdiction: z
            .enum(['CA'])
            .describe('Jurisdiction rule pack. Currently CA only; more arrive in subsequent minor versions.'),
          days: z
            .array(ResolveDayInputSchema)
            .describe('One ResolveDayInput per duty date in the audit window. Order is preserved.'),
          waivers: z
            .array(
              z.object({
                applies: z.enum(['first-meal', 'second-meal']),
                date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(),
                signed: z.boolean(),
                fileRef: z.string().optional(),
              }),
            )
            .optional(),
        },
        async ({ employeeId, jurisdiction, days, waivers = [] }) => {
          const rules = BREAK_RULE_SETS[jurisdiction];
    
          type PerDay = {
            date: string;
            result: DayResult;
            compliance: BreakComplianceResult;
          };
    
          const perDay: PerDay[] = days.map((input) => {
            const result = resolveDay(input);
            const compliance = evaluateBreakCompliance({ result, rules, waivers });
            return { date: input.date, result, compliance };
          });
    
          const totalPremiumHours = perDay.reduce(
            (acc, d) => ({
              meal: acc.meal + d.compliance.premiumsOwed.meal,
              rest: acc.rest + d.compliance.premiumsOwed.rest,
            }),
            { meal: 0, rest: 0 },
          );
    
          const daysByStatus = perDay.reduce<Record<string, number>>((acc, d) => {
            acc[d.result.status] = (acc[d.result.status] ?? 0) + 1;
            return acc;
          }, {});
    
          const flagCounts = perDay.reduce<Record<string, number>>((acc, d) => {
            for (const f of d.result.flags) acc[f] = (acc[f] ?? 0) + 1;
            return acc;
          }, {});
    
          const highRiskDays = perDay
            .filter((d) => d.compliance.presumptionRisk === 'high')
            .map((d) => d.date);
    
          const daysAtRisk = perDay.filter((d) => d.compliance.presumptionRisk !== 'low').length;
    
          const presumptionRiskCounts = perDay.reduce<Record<string, number>>((acc, d) => {
            acc[d.compliance.presumptionRisk] = (acc[d.compliance.presumptionRisk] ?? 0) + 1;
            return acc;
          }, {});
    
          const waiverIssuesAll = perDay.flatMap((d) =>
            d.compliance.waiverIssues.map((issue) => ({ date: d.date, issue })),
          );
    
          const totalWorkedMinutes = perDay.reduce((acc, d) => acc + d.result.workedMinutes, 0);
          const totalOtMinutes = perDay.reduce((acc, d) => acc + d.result.otMinutes, 0);
    
          return {
            content: [
              jsonText({
                employeeId: employeeId ?? null,
                jurisdiction,
                daysAnalysed: days.length,
                workedHours: +(totalWorkedMinutes / 60).toFixed(2),
                overtimeHours: +(totalOtMinutes / 60).toFixed(2),
                totalPremiumHours,
                daysAtRisk,
                highRiskDays,
                presumptionRiskCounts,
                daysByStatus,
                flagCounts,
                waiverIssues: waiverIssuesAll,
                perDay,
              }),
            ],
          };
        },
      );
    }
  • The 'ResolveDayInputSchema' Zod schema used in the 'days' parameter of the tool. Defines the structure for each day input (date, punches, shift, policy, leave, holiday, weekend).
    export const ResolveDayInputSchema = z.object({
      date: z
        .string()
        .regex(/^\d{4}-\d{2}-\d{2}$/)
        .describe('Duty date in worksite local wall-clock, YYYY-MM-DD.'),
      punches: z.array(PunchSchema),
      shift: ShiftConfigSchema,
      policy: AttendancePolicySchema.optional(),
      leave: LeaveDaySchema.nullable().optional(),
      holiday: z.boolean().optional(),
      weekend: z.boolean().optional(),
    });
  • Inline Zod schema for the optional 'waivers' parameter (array of objects with applies, date, signed, fileRef).
    waivers: z
      .array(
        z.object({
          applies: z.enum(['first-meal', 'second-meal']),
          date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(),
          signed: z.boolean(),
          fileRef: z.string().optional(),
        }),
      )
      .optional(),
  • src/server.ts:16-16 (registration)
    Import of the tool registration function from the audit-period-compliance module.
    import { registerAuditPeriodCompliance } from './tools/audit-period-compliance.js';
  • src/server.ts:42-42 (registration)
    Call to registerAuditPeriodCompliance(server) to wire the tool into the MCP server.
    registerAuditPeriodCompliance(server);
Behavior4/5

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

With no annotations, the description bears full responsibility for behavioral disclosure. It explains the tool resolves attendance and evaluates compliance, lists output elements (premium hours, days at risk, etc.), and notes jurisdiction limitations. It does not explicitly state whether the tool is read-only or has side effects, but the output focus suggests a read operation. The description is transparent enough for effective use.

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 concise at four sentences, each serving a clear purpose. It starts with the main action, then details the process and output, and ends with use cases. No extraneous information, and the structure is front-loaded.

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 complexity of the tool (nested inputs, no output schema), the description adequately covers the output structure and key behaviors. It lists the types of results (per-day breakdown, period totals, premium hours, risk days, etc.). It does not address error handling or edge cases, but the level of detail is sufficient for an agent to understand what the tool returns.

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 75%, so baseline is 3. The tool description adds little beyond the schema: it mentions jurisdiction rule packs and output structure, but does not elaborate on parameter meanings or constraints. The schema already provides detailed descriptions for most parameters, so the description does not significantly enhance semantics.

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 starts with a specific verb 'Run a wage-and-hour compliance audit across multiple days' and clearly identifies the resource. It distinguishes the tool from siblings like resolve_day (single day) and evaluate_break_compliance (focused on breaks) by emphasizing multi-day, comprehensive audit with jurisdiction rules and per-day plus period totals.

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 explicit use cases: 'Use this for monthly payroll review, pre-audit triage, or a manager dashboard.' This gives clear positive guidance on when to use it. It does not explicitly state when not to use it or mention alternatives, but the context from siblings is sufficient for an agent to infer.

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/arifur9993/attendance-engine-mcp'

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