Skip to main content
Glama

Build an optimized shift roster

build_shift_roster
Read-onlyIdempotent

Solve a staff rostering problem to optimality with a MILP solver and return who works which shift each day, coverage, unfilled posts, hours per person and warnings. Solves take 5-60 s. Pass either example (to solve a built-in example as-is) or the roster input fields. If the result has status 'running', call get_shift_roster_result with its job_id. If it has status 'too_large', shorten the horizon or reduce people/shift types and retry. If it has status 'busy', wait the retry_after_seconds it gives and call again -- one call at a time, never in parallel. Safe defaults (e.g. the next 7 days when days is omitted) are listed in the result's assumptions; tell the user about them. Roster input. Minimal example: {"days": ["2026-10-05", "2026-10-06"], "shifts": [{"shift": "Day", "start": "07:00", "end": "19:00"}, {"shift": "Night", "start": "19:00", "end": "07:00", "night": "yes"}], "demands": [{"name": "RN", "penalty": 500}], "people": [{"name": "Ana", "cost": 40, "max_hw": 48}, ...], "grids": {"RN": {"2026-10-05|Day": 2, "2026-10-05|Night": 1}}, "parameters": {"MinRestHours": 11}}. Call get_shift_example for complete, realistic inputs.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "build_shift_roster"
  }
}

Input Schema

NameRequiredDescriptionDefault
daysNoOPTIONAL. Day labels in order: ISO dates ('2026-10-05') or weekday names ('Mon'). Dates or weekdays enable weekend rules. Omit it to plan the next 7 days (ISO dates starting tomorrow); the default used is reported in the result's `assumptions`.
goalNoOne sentence, in the user's own words, of what they are trying to do (e.g. 'a 4-week nurse rota for 12 nurses on 12-hour shifts'). Optional; helps improve the tool.
gridsNoOptional per-day/shift cells, keyed by a demand name or a person name, each an object keyed 'DAY|SHIFT'. Demand grid value = headcount required (demand with no grid = 1 on every shift). Person grid value: 'a' or 1 = available, 'f' = must work, 0 or missing = UNAVAILABLE (person with no grid = available everywhere).
peopleNo
shiftsNoShift types. A shift may cross midnight (end < start).
skillsNoWho can cover which demand. Omitted = everyone can cover every demand.
demandsNoPosts to fill (roles). Headcount per day/shift goes in grids.
exampleNoSolve this built-in example instead of passing the fields below.
parametersNoOptional rules. MinRestHours (11), MaxConsecutiveDays (6), MaxConsecutiveNights (4), ForbidDayAfterNight ('yes'), NightStartsAfter ('18:00'), MinBlockDays (1), WeekendFairnessPenalty (0), EquityPenalty (0) = even out total hours, NightEquityPenalty (0) = even out total nights (try 20), NightDifferential (1.0), WeekendDifferential (1.0), TimeLimitSeconds (max 60 here), GapPercent (2).
wait_secondsNoHow long to wait for the solve inside this call (default 25).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / days / description
      Previous value: -"Day labels in order: ISO dates ('2026-10-05') or weekday names ('Mon'). Dates or weekdays enable weekend rules."New value: +"OPTIONAL. Day labels in order: ISO dates ('2026-10-05') or weekday names ('Mon'). Dates or weekdays enable weekend rules. Omit it to plan the next 7 days (ISO dates starting tomorrow); the default used is reported in the result's `assumptions`."
  2. Changed1 schema field changed
    • addedInput schema / properties / goal
      Added value: +{
      +  "description": "One sentence, in the user's own words, of what they are trying to do (e.g. 'a 4-week nurse rota for 12 nurses on 12-hour shifts'). Optional; helps improve the tool.",
      +  "maxLength": 300,
      +  "type": "string"
      +}
  3. Changed1 schema field changed
    • changedInput schema / properties / parameters / description
      Previous value: -"Optional rules. MinRestHours (11), MaxConsecutiveDays (6), MaxConsecutiveNights (4), ForbidDayAfterNight ('yes'), NightStartsAfter ('18:00'), MinBlockDays (1), WeekendFairnessPenalty (0), EquityPenalty (0) = even out total hours, NightEquityPenalty (0) = even out total nights (try 20), NightDifferential (1.0), WeekendDifferential (1.0), TimeLimitSeconds (max 120 here), GapPercent (2)."New value: +"Optional rules. MinRestHours (11), MaxConsecutiveDays (6), MaxConsecutiveNights (4), ForbidDayAfterNight ('yes'), NightStartsAfter ('18:00'), MinBlockDays (1), WeekendFairnessPenalty (0), EquityPenalty (0) = even out total hours, NightEquityPenalty (0) = even out total nights (try 20), NightDifferential (1.0), WeekendDifferential (1.0), TimeLimitSeconds (max 60 here), GapPercent (2)."
  4. First observed

TDQS

A4.2/5.0
Behavior3/5

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

The annotations already declare readOnlyHint/idempotentHint/destructiveHint=false, so safety is covered; the description still adds real value with solve latency (5-60 s), the four outcome statuses, and the no-parallel-calls rule. However, it does not explain that a long solve can be deferred into a job, nor what happens to a job that is never polled, so the async lifecycle stays partly opaque.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well front-loaded: purpose and return values first, then the operational status branches, then the input example and a pointer to get_shift_example. A few fragments ('Roster input.', the trailing '...' in the sample JSON) are slightly untidy, but nothing is genuinely wasted for a 10-parameter tool.

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, yet the description enumerates the response contents and every status value an agent must react to, including the `assumptions` field and the instruction to surface defaults to the user. For a complex nested-input solver with an async path, nothing essential is missing before calling it.

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 coverage is 90%, so the schema already carries parameter meaning and the baseline applies. The description adds a compact worked example that shows how days, shifts, demands, grids ('2026-10-05|Day') and parameters interlock, plus the reassurance that defaults appear in `assumptions` — useful, but it does not clarify the trickier semantics (skills rate, concurrent demands) beyond the 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?

Opens with a specific verb and resource ('Solve a staff rostering problem to optimality with a MILP solver') and enumerates the return payload (who works which shift, coverage, unfilled posts, hours per person, warnings). It is clearly distinguishable from get_shift_roster_result and get_shift_example, which it names as its own follow-ups.

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

Usage Guidelines5/5

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

Gives explicit routing for every branch: pass `example` versus the input fields, call get_shift_roster_result on status 'running', shorten the horizon on 'too_large', and back off on 'busy' with the retry_after_seconds it returns. It also states a hard concurrency constraint ('one call at a time, never in parallel') and points to get_shift_example for realistic inputs.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources