Skip to main content

MCP tools, resources and prompts

cmd/mcp serves MCP over Streamable HTTP at /mcp and /, plus GET /healthz, on MCP_ADDR (:8090) (cmd/mcp/router.go). It is unauthenticated, like the REST API. It runs the same use cases as the REST service through internal/adapters/inbound/mcp (ADR 0008), and every path id is validated against the same process-path catalogue (ADR 0013). Each tool call runs in an OTel span mcp.tool <name>. The rules that govern the surface are in the Governance charter.

Tools​

ToolAnnotationsAuthorityUse caseRegistered
get_staffing_gapreadOnlyHint: trueL1GetStaffingGap.ExecuteForSitealways
propose_path_headsreadOnlyHint: trueL2ProposePathPlan.Executealways
assign_laborreadOnlyHint: false, destructiveHint: true, idempotentHint: falseL3AssignLabor.ExecuteInitiatedByalways
get_workforce_labor_reportreadOnlyHint: trueL1none. Calls GET /reports/labor on cmd/workforce-reports.only when REPORTS_BASE_URL is set

Every tool declares its authority level in its Meta under com.warehouse/authority (returned in tools/list _meta); the A2A skills carry the same level as the tag authority:L<n>. L2 marks a pure recommendation. The level is a label, not access control (ADR 0041). The server is stateless: it answers the 2026-07-28 server/discover handshake and still answers a legacy initialize.

The registry is pinned by testdata/tool_registry.golden (name, read-only, destructive, authority) and checked for fleet-wide name uniqueness against testdata/fleet_tool_snapshot.golden. See Testing.

"Read-only" describes the client contract. get_staffing_gap and propose_path_heads still publish events: PathUnderstaffed for each understaffed path read, and ShiftPlanProposed for every proposal (see Use cases).

get_staffing_gap​

Planned vs active heads for one path in a site's committed shift plan.

InputTypeRequiredMeaning
siteCodestringone of siteCode/buildingIdCanonical site code, e.g. WH1. It is the plan key and the associate scope: only associates with an active shift at that site are counted.
buildingIdstringDeprecated alias of the plan key. A call with only buildingId is not scoped by site. Sending both with different values is rejected.
shiftIdstringyesShift whose committed plan to read.
pathIdstringyesProcess path, validated against the catalogue.

Output: buildingId, shiftId, pathId, plannedHeads, activeHeads, understaffed, and siteCode (only when the read was scoped by site). There is no observedIdlePct on this surface.

propose_path_heads​

Headcount needed to clear a charge at a planned rate. It commits nothing.

InputTypeRequiredMeaning
siteCodestringone of siteCode/buildingIdSite the proposal is for.
buildingIdstringDeprecated alias with the same value.
pathIdstringyesProcess path, validated against the catalogue.
chargenumberyesUnits the path must clear. Must be at least 0.
plannedRatenumberyesUnits per head per hour. Must be greater than 0.

Output: siteCode, buildingId, pathId, charge, plannedRate, proposedHeads. plannedRate is mandatory here, and cmd/mcp wires no measured-rate or idle-share client. So unlike the REST endpoint, this tool never uses labor-performance's measured rate and never trims for idle share.

assign_labor (write)​

Puts an associate on a path and ends their previous active assignment.

InputTypeRequiredMeaning
associateIdstringyesAssociate to move.
pathIdstringyesTarget path, validated against the catalogue. The associate must hold the path family's certification.
proposalIdstringnoProposal this assignment executes. Trimmed, at most 128 characters.
approvedBystringnoWho approved the proposal. Trimmed, at most 128 characters.
agentIdstringnoThe calling agent. Trimmed, at most 128 characters.

The three optional inputs are attribution labels, not credentials: they grant nothing and never change whether the call is accepted. The adapter stamps via: "mcp" itself (it is not an argument), and the published event gains data.initiated_by (via, plus proposal_id, approved_by, agent_id when given). REST never produces it. See the LaborAssigned and LaborReassigned schemas in apis/asyncapi.yaml.

Output: associateId, pathId, assignmentId (<associateId>@<pathId>). Domain rejections (not found, missing certification, on break, shift ended, max hours) come back as the tool error unchanged. There is no Idempotency-Key on MCP, so a repeated call simply assigns again; it is annotated non-idempotent. Every attempt is counted on workforce.labor_assignments. With a database and EVENT_PUBLISHER=kafka, LaborAssigned/LaborReassigned go into outbox_events, and the cmd/workforce relay ships them.

get_workforce_labor_report​

The Labor Utilization & Staffing data product, read over REST from cmd/workforce-reports. The MCP server never opens the analytical database.

InputTypeRequiredMeaning
fromstringyesWindow start, inclusive, RFC 3339.
tostringyesWindow end, exclusive, RFC 3339.
pathIdstringnoPath filter. Omitted or empty means all rows, including the building-wide bucket.
granularitystringnoOnly hour is supported; omitting it means hour.

Both optional fields carry omitempty, so the go-sdk publishes only from and to as required and a call without the filters is accepted (gap fix D16; until then the schema marked them required). The fitness test TestMCPOptionalToolInputsCarryOmitempty (internal/architecture/mcp_optional_inputs_test.go) fails when any MCP input field described as optional lacks omitempty, and TestLaborReportTool_OptionalFiltersMayBeOmitted calls the tool with only the window. The output is the reports API's rows array (see Runbook).

Resource templates​

URI templateStatusBehaviour
staffing://sites/{siteCode}/{shiftId}/{pathId}/gapcanonicalSame as get_staffing_gap scoped by siteCode. JSON.
staffing://{buildingId}/{shiftId}/{pathId}/gapdeprecated (ADR 0035)Plan key only, not scoped by site.

Prompts​

PromptPurpose
cover_staffing_gapsSOP: call get_staffing_gap per path, rank by shortfall, size with propose_path_heads, make only clearly safe assign_labor calls, treat a rejection as a hard stop, and escalate to a human when certified associates run out.

Scaling note​

Since ADR 0041 the server is stateless: no Mcp-Session-Id is issued and no session state is kept in process memory. The chart still deploys one replica with no HPA; raising that is a separate, deliberate change (see Runbook).