Skip to main content

MCP tools

warehouse-ops-agent runs its own MCP server so an agentic host can read its recommendations the same way it reads a bounded context's facts. The server is mounted at /mcp on the same router and port as the REST routes (AGENT_ADDR, default :8095). It uses Streamable HTTP in stateless mode (internal/adapters/inbound/mcp/server.go) and needs no authentication (ADR 0006). There is no separate cmd/mcp binary.

The server identifies itself as warehouse-ops-agent-mcp version 1.0.0. Every tool call runs inside an OTel span named mcp.tool <name> with the attribute mcp.tool.name (addTool in tools.go).

Authority levels​

Every tool declares exactly one authority level in its _meta under com.warehouse/authority (fleet contract G1-G3): the twelve plain reads are L1, labor_reallocation_outlook is L2 because it recommends a concrete action a human may then approve over REST. There is no L3/L4 tool on this server: the agent's two writes are REST-only act slices. The levels live in internal/adapters/inbound/mcp/authority.go; a tool missing from that table panics at registration, and TestEveryToolDeclaresExactlyOneAuthorityLevel registers every tool and pins the table to the registered set. Each tool call's mcp.tool <name> span also carries gen_ai.operation.name=execute_tool, gen_ai.agent.name=warehouse-ops-agent and warehouse.authority.

Tool list​

The table below comes from a live tools/list call against a binary built from this branch, with the three optional upstreams configured. "Required" is the required array of the published input schema: the go-sdk marks every field without omitempty as required.

ToolRead-onlyRegistered whenRequired inputsOptional inputsSame answer as
get_daily_briefyesalwaysnonenoneGET /daily-brief (without generatedAt)
list_open_exceptionsyesalwaysnoneseveritythe openExceptions of GET /daily-brief
get_flow_balance_exceptionyesalways (the use case is always wired)buildingId, shiftId, pathIdnoneGET /flow-balance/{pathId}
explain_travel_factoryesFACILITY_LAYOUT_MCP_ENDPOINT set (ADR 0023)pathId, fromLocationCode, toLocationCodenoneGET /explain-travel-factor
detect_stranded_reservationyesalwaystaskType, sku, minUsableThresholdwithinSeconds, reservationId, binIdno REST route
find_master_data_gapsyesPRODUCT_MASTER_MCP_ENDPOINT is setnonekind, cursorGET /master-data-gaps
get_inbound_outlookyesINBOUND_RECEIVING_MCP_ENDPOINT is setnonenoneGET /inbound-outlook
triage_stuck_transfersyesNETWORK_INVENTORY_PLANNING_MCP_ENDPOINT is setolderThanMinutesstate, limitGET /transfer-watch/stuck
get_transfer_statusyesNETWORK_INVENTORY_PLANNING_MCP_ENDPOINT is settransferIdnoneGET /transfer-watch/transfers/{id}
explain_network_imbalanceyesNETWORK_INVENTORY_PLANNING_MCP_ENDPOINT is setnonenoneGET /transfer-watch/imbalance
get_network_order_outlookyesCUSTOMER_ORDERING_MCP_ENDPOINT is set (ADR 0026)orderIdnoneno REST route
get_network_node_outlookyesNODE_TOPOLOGY_MCP_ENDPOINT is set (ADR 0026)nodeIdnoneno REST route
labor_reallocation_outlookyesWORKFORCE_MANAGEMENT_MCP_ENDPOINT is set (ADR 0029)siteCode, shiftId, toPathId, candidates (1-20 of associateId, optional fromPathId)nonethe ranking behind POST /labor-reallocation/proposals, without a token, proposal id or expiry

All thirteen carry ReadOnlyHint: true. The agent has no write tool. internal/architecture/zerowrite/zerowrite_test.go (TestNoMutatingToolAnnotationInMCPServer) fails the build if a tool is registered without the read-only hint. See the governance note for why.

explain_travel_factor requires pathId in its schema although the use case only logs it. A host must send it, and an empty string is accepted.

Inputs and behaviour​

get_daily_brief​

No input. Returns sites and openExceptions with the same shape as GET /daily-brief. It never fails: an unavailable upstream shows up in a path's unavailable list.

list_open_exceptions​

FieldTypeMeaning
severitystring, optionalMinimum severity: info, warning or critical. Omit it to get every exception.

Returns count and exceptions[]. Any other severity value is a tool error, invalid severity "<value>": must be info, warning, or critical (errors.go). It is never replaced by a default.

get_flow_balance_exception​

FieldTypeMeaning
buildingIdstringbuilding of the path, for the workforce-management staffing lookup
shiftIdstringshift to check staffing against
pathIdstringwes-work-planning path id

Returns pathId, recommendedAction (assign_labor, release_next_work or hold), proposedHeads, rationale, partial, missingSignals, evidence[] (source, detail), utilization and source (deterministic, llm or fallback). It fails only when wes-work-planning returns an unknown rebalance action. The upstream calls are the ones listed under GET /flow-balance/{pathId} on the HTTP routes page.

explain_travel_factor​

FieldTypeMeaning
pathIdstringpath under investigation, only logged
fromLocationCodestringseven-segment facility-layout code, e.g. WH1-STOR-AMB-A07-01-01-A
toLocationCodestringseven-segment facility-layout code

Calls facility-layout estimate_travel_distance and returns metresM, estimated, kind (travel_significant above 60 m, else travel_negligible) and rationale. A missing code, or a facility-layout validation rejection, is a tool error whose text starts with invalid input:. The tool never guesses a location code (ADR 0009).

detect_stranded_reservation​

FieldTypeMeaning
taskTypestringPICK, PACK or SLAM; anything else is a tool error (policy: unknown task type)
withinSecondsinteger, optionalwindow passed to fulfillment-execution diagnose_stuck_tasks; 0 means already-expired leases only
skustringSKU suspected of being stranded
minUsableThresholdintegerusable quantity at or below which a shortfall counts as correlated
reservationIdstring, optionalreservation the tool may recommend revoking
binIdstring, optionalbin holding that reservation, used for the blast radius

Upstream calls: fulfillment-execution diagnose_stuck_tasks, inventory-storage check_availability (when sku is set) and inventory-storage get_bin_occupancy (only when both reservationId and binId are set).

Returns detected, action (revoke_reservation or hold), reservationId, rationale, evidence[] (tool, summary) and blastRadius (sku, binId, reservationId, quantityFreed, binLines[]). revoke_reservation is recommended only when expired leases of taskType exist, usable stock is at or below the threshold, a reservationId was given and the bin occupancy was read. Every other path returns hold. The tool never calls inventory-storage's revoke_reservation itself.

find_master_data_gaps​

FieldTypeMeaning
kindstring, optionalunclassified or dimension-discrepancy; omit for both
cursorstring, optionalnextCursor of an earlier incomplete scan

Same report as GET /master-data-gaps: at most 5,000 products per call, complete: false plus nextCursor when the bound is hit. An unknown kind is a tool error. A product-master failure is a tool error too: the report has no partial mode.

get_inbound_outlook​

No input. Same four sections as GET /inbound-outlook, each with omitted, complete, count and items. It is a tool error only when every attempted section failed.

triage_stuck_transfers​

FieldTypeMeaning
olderThanMinutesintegera transfer is stuck when its state has not changed for longer than this; it must be positive
statestring, optionalone non-terminal state: DRAFT, PROPOSED, APPROVED, ALLOCATING, ALLOCATED, PICKED, IN_TRANSIT, ARRIVED
limitinteger, optionalpage size, 0 to 200; 0 uses the network-inventory-planning default

Calls network-inventory-planning find_stuck_transfers. Returns total, transfers[] (each with triage: cause, summary, nextCheck) and causeCount[].

get_transfer_status​

FieldTypeMeaning
transferIdstringinter-warehouse transfer id

Calls network-inventory-planning get_transfer. Returns the transfer, its audit[] trail and its triage. An unknown id is a tool error whose text starts with transfer not found:.

explain_network_imbalance​

No input. Calls network-inventory-planning simulate_transfer_options and returns advisory, asOf, imbalanced, sites[] (balance is short or covered), summary and nextCheck. It is a tool error while network-inventory-planning's read models are not fresh. The tool never proposes a quantity or a route.

get_network_order_outlook​

FieldTypeMeaning
orderIdstringthe customer order id to assemble the picture for

Six sections over the ADR-0025 clients, each with the inbound outlook's omitted / complete / count / items envelope: order (customer-ordering get_order: lines and shipment groups), tracking (get_order_tracking: per-group promise verdict and packages), shipTo (get_ship_to), promises (delivery-promise list_promises_by_order, with get_promise covering a group the list missed — or every group when the list call failed), sourcing (order-sourcing list_assignments filtered by order) and journeys (shipping-and-tracking get_journey per tracking number, at most 20 reads; a failed journey keeps its slot with an error field). A section whose upstream is unconfigured is omitted with not-configured; the tool errors only when every attempted section failed. Registered only when customer-ordering (the anchor) is configured. No REST route (ADR 0026).

get_network_node_outlook​

FieldTypeMeaning
nodeIdstringthe network node id to assemble the picture for

Ten sections: node (node-topology get_node with a summarized operational profile), inboundLanes / outboundLanes (list_lanes by destination / origin), scorecards (node-performance get_scorecard), listings (offer-availability list_listings filtered by node, at most 5,000 per call), inventoryFeed (get_inventory_feed on the freshest feed the node's listings reference), vendor / vendorScores (vendor-connectivity get_vendor_node + get_node_scorecard, only when node-topology registered the node under a vendor), departures (linehaul-transportation list_departures, origin=node, from=now) and waves (last-mile-delivery list_waves for the node's local service date — only for a DELIVERY_STATION node; other nodes carry the explicit "not a delivery station" omission). Same degradation envelope as the order outlook; registered only when node-topology (the anchor) is configured. No REST route (ADR 0026).

Tool errors​

A tool handler's Go error becomes an MCP result with isError: true and the error text as content (addTool returns it to the go-sdk). The text is the use case's own message, for example invalid input: find stuck transfers: olderThanMinutes must be positive. This server does not prefix its errors with a kebab-case slug, unlike the upstream servers that follow the convention in ADR 0018.

Calling the server​

The server is stateless, so initialize returns no Mcp-Session-Id and every request stands alone:

curl -s http://localhost:8095/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

The answer comes back as one event: message server-sent event whose data: line holds the JSON-RPC response.

The upstream tools this agent calls​

The outbound side (internal/adapters/outbound/mcpclient) is listed per upstream on Integration. The LLM reasoner can call only the tools on LLM_TOOL_ALLOWLIST (Configuration).