Skip to main content
Glama

apply_rounding

Rounds worked and overtime minutes, preserving the exact-minute baseline for provably neutral compliance comparisons.

Instructions

Produce a rounded view of a resolved day's worked & overtime minutes without losing the exact-minute result. Useful for the California-style 'exact-minute is the baseline; rounding must be provably neutral' pattern — keep both views and compare across populations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes
roundingYes

Implementation Reference

  • The async handler for the 'apply_rounding' tool. It calls resolveDay(input) to get an exact DayResult, then applyRounding(exact, rounding) to produce a rounded view, returning both as JSON.
        async ({ input, rounding }) => {
          const exact = resolveDay(input);
          const rounded = applyRounding(exact, rounding);
          return { content: [jsonText({ exact, rounded })] };
        },
      );
    }
  • Zod schema for the 'rounding' parameter: unit (minutes, integer >=1), mode (nearest/up/down, optional, defaults to nearest), and applyTo (array of field names to round, optional).
    export const RoundingOptionsSchema = z.object({
      unit: z.number().int().min(1),
      mode: z.enum(['nearest', 'up', 'down']).optional(),
      applyTo: z
        .array(z.enum(['workedMinutes', 'otMinutes', 'lateByMinutes', 'earlyOutMinutes', 'breaksDeducted']))
        .optional(),
    });
  • Registers the tool named 'apply_rounding' on the MCP server with its description, input schema, and rounding options schema.
    export function registerApplyRounding(server: McpServer): void {
      server.tool(
        'apply_rounding',
        "Produce a rounded view of a resolved day's worked & overtime minutes without losing the exact-minute result. Useful for the California-style 'exact-minute is the baseline; rounding must be provably neutral' pattern — keep both views and compare across populations.",
        {
          input: ResolveDayInputSchema,
          rounding: RoundingOptionsSchema,
        },
        async ({ input, rounding }) => {
          const exact = resolveDay(input);
          const rounded = applyRounding(exact, rounding);
          return { content: [jsonText({ exact, rounded })] };
        },
      );
    }
  • src/server.ts:39-39 (registration)
    Calls registerApplyRounding(server) to wire the tool into the server during startup.
    registerApplyRounding(server);
  • Helper jsonText function used by the handler to serialize the response as pretty-printed JSON wrapped in an MCP text content block.
    export function jsonText(value: unknown): { type: 'text'; text: string } {
      return { type: 'text', text: JSON.stringify(value, null, 2) };
    }
Behavior3/5

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

With no annotations, the description should fully disclose behavior. It explains that the tool keeps both rounded and exact-minute views, which is helpful. But it does not mention side effects, state changes, authorization needs, or output format, leaving 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 two sentences, front-loads the primary purpose, and includes a concrete use case. Every sentence adds value without redundancy.

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 complex nested parameters and no output schema, the description is brief. It explains the core function but omits details about the output structure, how the rounding unit/mode apply, and how it integrates with sibling resolve tools. It is adequate for a domain expert but not fully self-contained.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 2 top-level parameters with no descriptions in the schema (0% coverage). The description adds no parameter-specific information, so the agent must infer meaning solely from the property names and nested schema, which is insufficient for correct invocation.

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 the tool produces a rounded view of worked and overtime minutes while preserving exact-minute results. It distinguishes itself from siblings like resolve_day by focusing on rounding, and it specifies a domain context (California-style rounding pattern).

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 a specific use case ('California-style... pattern') and implies when to use it (after resolution, for rounding). However, it does not explicitly state when not to use or compare with siblings like audit_period_compliance or resolve_period, leaving some ambiguity.

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