Skip to main content
Glama

generate_roster

Generate a rotating roster using built-in patterns (2-2-3, 4-on-4-off, dupont, pitman) or a custom day cycle. Returns shift assignment per date with label and HH:MM window, null on rest days.

Instructions

Generate a rotating roster from a built-in pattern ('2-2-3', '4-on-4-off', 'dupont', 'pitman') or a custom day cycle. Returns one assignment per calendar date with shift label and HH:MM window, or null on rest days.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternYes
startDateYes
daysYes

Implementation Reference

  • The handler function that registers and implements the 'generate_roster' MCP tool. It accepts a pattern (built-in or custom), a start date, and a number of days, calls the core engine's generateRoster function, and returns the result as JSON text.
    export function registerGenerateRoster(server: McpServer): void {
      server.tool(
        'generate_roster',
        "Generate a rotating roster from a built-in pattern ('2-2-3', '4-on-4-off', 'dupont', 'pitman') or a custom day cycle. Returns one assignment per calendar date with shift label and HH:MM window, or null on rest days.",
        {
          pattern: RosterPatternSchema,
          startDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
          days: z.number().int().min(0),
        },
        async ({ pattern, startDate, days }) => {
          const roster = generateRoster(pattern, startDate, days);
          return { content: [jsonText(roster)] };
        },
      );
    }
  • The RosterPatternSchema validates the 'pattern' input. It accepts either a built-in pattern name ('2-2-3', '4-on-4-off', 'dupont', 'pitman') or a custom array of 'off' literals and shift objects (with label, start, end).
    export const RosterPatternSchema = z.union([
      z.enum(['2-2-3', '4-on-4-off', 'dupont', 'pitman']),
      z.object({
        custom: z.array(
          z.union([
            z.literal('off'),
            z.object({
              label: z.string(),
              start: z.string().regex(/^\d{2}:\d{2}$/),
              end: z.string().regex(/^\d{2}:\d{2}$/),
            }),
          ]),
        ),
      }),
    ]);
  • src/server.ts:40-43 (registration)
    Registration of the generate_roster tool on the MCP server at line 40: registerGenerateRoster(server);
    registerGenerateRoster(server);
    registerListRulePacks(server);
    registerAuditPeriodCompliance(server);
    registerDiagnosePunches(server);
  • The jsonText helper used by the handler to serialize the roster result as a JSON text content block for MCP response.
    export function jsonText(value: unknown): { type: 'text'; text: string } {
      return { type: 'text', text: JSON.stringify(value, null, 2) };
    }
  • Documentation entry referencing generate_roster tool as part of the MCP server overview.
    - **generate_roster** — rotating-roster generation (2-2-3, 4-on-4-off, dupont, pitman, custom)
    - **list_rule_packs** — discover available jurisdictions
    
    Time-zone rule: every ISO timestamp must carry an explicit offset. The engine never
    reads the host timezone. DST days work because offsets are explicit.
    
    Source: https://github.com/arifur9993/attendance-engine
    `;
    
    const API_MARKDOWN = `# attendance-engine — quick API reference
    
    ## resolve_day(input)
Behavior4/5

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

No annotations exist, so description fully carries burden. It discloses input constraints (pattern format, date format, day count) and output structure (shift label, time window, null for rest). Does not state side effects, but generation is likely read-only. Adequate for a generation tool.

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?

Two sentences: first states purpose and options, second details output. No fluff, every word adds value.

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

Completeness5/5

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

No output schema exists; description covers return values completely (assignment per date with shift label and time window, null for rest). All parameters explained. Adequate for full understanding.

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

Parameters4/5

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

Schema has 0% description coverage; description compensates by explaining the two options for 'pattern' (built-in enums listed, plus custom object with array of off or objects) and mentions 'startDate' and 'days' formats. Adds significant meaning beyond raw schema.

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?

Description explicitly states 'Generate a rotating roster' and details output format (assignment per date with shift label and time window, or null). Clearly distinguishes from siblings which are unrelated (e.g., rounding, compliance).

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

Usage Guidelines3/5

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

Describes inputs (built-in patterns or custom cycles) and output, but does not specify when to use or avoid, nor prerequisites. Given sibling tools are unrelated, context is adequate but lacks explicit guidance.

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