Skip to main content

MCP tools

cmd/mcp is a separate binary and Deployment (ADR 0010) that exposes order-management to AI agents over the Model Context Protocol. It is read-only: no command of this context is offered as a tool, because receiving, allocating, retrying and cancelling orders carry business invariants that an agent should not decide on this context's behalf. Since ADR 0012 there is no authentication.

PropertyValue
TransportStreamable HTTP only (github.com/modelcontextprotocol/go-sdk v1.8.0)
Endpointevery path under MCP_ADDR (default :8090): the handler is mounted on the chi pattern /*, which also matches /. In the cluster: http://order-management-mcp.<ns>.svc.cluster.local:8090/
Server infoname order-management-mcp, version 1.0.0
Capabilitiestools (with listChanged), logging, resources (one template), prompts (one SOP)
Sessionsnone (stateless, Agentic Standard v2 ADR 0049): no Mcp-Session-Id is issued, the server answers the 2026-07-28 per-request handshake (server/discover) and legacy initialize clients alike
Authorityevery tool declares com.warehouse/authority in tools/list _meta: get_order = L1, get_promise_health = L1 (the surface is read-only; ADR 0049)
Resourcewarehouse://order-management/orders/{orderId} — the order read model (same GetOrder use case as get_order), one order, JSON text
Promptinvestigate_order — the operator SOP: read the order, interpret statuses, check promise health, escalate policy calls to a human
Telemetryone span mcp.tool <name> per call; http.server.request.duration and http.server.active_requests
Backing dataget_order: the OLTP database (DATABASE_URL, in-memory when unset). get_promise_health: the analytical database (ANALYTICS_DATABASE_URL, an empty store when unset)

The schemas below are copied from a tools/list against a locally built cmd/mcp on 2026-10-12. The go-sdk adds "additionalProperties": false to every input, so an unknown argument is rejected.

get_order​

Annotations: readOnlyHint: true, idempotentHint: false. Authority: L1 (com.warehouse/authority, ADR 0049).

Return one order's current state by id: status, allow-partial-shipment flag, promise date, and every line's SKU/quantity/process-path/gift-wrap/status/reservation-id.

InputTypeRequiredDescription
orderIdstringyesthe id of the order to look up

Output (structured content):

FieldTypeNotes
idstring
statusstringderived order status (Received, Allocated, PartiallyAllocated, Backordered, Released, PartiallyReleased, Shipped, PartiallyShipped, Cancelled; Shipped and PartiallyShipped only with the outbound-shipping consumer on, ADR 0051)
allowPartialShipmentboolean
promiseDatestring, RFC 3339omitted when no promise is set
lines[]arraylineNo, sku, quantity, pathId, giftWrap, status, reservationId (omitted when not allocated)

Unlike GET /orders/{id}, the tool does not return releaseOnAllocation, requiredShipBy or capacityConstraint.

Errors are tool results with isError: true and a text message: an unknown id gives order not found, an empty id order id must not be empty.

get_promise_health​

Annotations: readOnlyHint: true, idempotentHint: false. Authority: L1 (com.warehouse/authority, ADR 0049).

Return promise-health KPIs for a time window (and optional process-path filter) from the Order Funnel & Allocation Health data product.

InputTypeRequiredDescription
fromstringyesinclusive start of the time window, RFC3339
tostringyesexclusive end of the time window, RFC3339
pathIdstringnooptional exact-match process path filter

pathId is json:"pathId,omitempty", so the generated input schema does not list it as required and a call without it succeeds. TestOptionalMCPInputsCarryOmitempty (internal/architecture) fails the build if a field whose jsonschema description says "optional" lacks omitempty.

Output (structured content), summed over the hourly rows of /reports/funnel for the window:

FieldTypeMeaning
promiseBasisCapability, promiseBasisLeadTime, promiseBasisNetworkintegerallocations per promise basis
ordersAllocatedTotalintegerthe sum of the three bases
ordersSplitShipment, splitShipmentRateinteger, numberorders promised to more than one cutoff, and that count over ordersAllocatedTotal
ordersRepromised, repromiseRateinteger, numberre-promises, and that count over ordersAllocatedTotal. Re-promises carry no path, so a pathId filter makes both 0.
promiseToCutoffGapSecondsnumbersample-weighted mean of (cutoff − allocation time) over capability promises

On-time-to-CPT is not here: fulfillment-execution measures it. A from or to that is not RFC 3339 returns a tool error such as from must be an RFC3339 timestamp: ….

A session by hand​

# 1. initialize: note the Mcp-Session-Id response header
curl -s -D - http://localhost:8090/ \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"0"}}}'

SID=... # value of Mcp-Session-Id

# 2. confirm initialization, then list and call tools
curl -s http://localhost:8090/ -H "Mcp-Session-Id: $SID" \
-H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","method":"notifications/initialized"}'

curl -s http://localhost:8090/ -H "Mcp-Session-Id: $SID" \
-H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_promise_health","arguments":{"from":"2026-10-01T00:00:00Z","to":"2026-10-02T00:00:00Z"}}}'

Responses arrive as server-sent events. Against a binary with no ANALYTICS_DATABASE_URL the last call returned:

event: message
data: {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"{...}"}],"structuredContent":{"ordersAllocatedTotal":0,"ordersRepromised":0,"ordersSplitShipment":0,"promiseBasisCapability":0,"promiseBasisLeadTime":0,"promiseBasisNetwork":0,"promiseToCutoffGapSeconds":0,"repromiseRate":0,"splitShipmentRate":0}}}

See the MCP Governance Charter for the rules any new tool must follow, and Testing for the evals that pin these schemas.