Skip to main content

MCP tools

cmd/mcp serves a read-only Model Context Protocol server over Streamable HTTP only (ADR 0006). It is unauthenticated like the rest of the fleet: the in-cluster ClusterIP boundary is the access control.

Listen addressMCP_ADDR, default :8090
Endpoint/mcp (also mounted at /)
ProbeGET /healthz returns 200 {"status":"ok"}
NeedsDATABASE_URL only; it dials no Kafka and registers no write seam
Gateway/api/mcp/seller-inbound in warehouse-infra (helm-values/seller-inbound.yaml, mcp.route.path); the ops agent calls http://seller-inbound-mcp.warehouse-systems.svc.cluster.local:8090/mcp
Deployed bythe chart behind mcp.enabled (default off, on in warehouse-infra)

Source: cmd/mcp/main.go, cmd/mcp/router.go, internal/adapters/inbound/mcp/{server,tools,errors}.go.

How this page was produced. The list below comes from the pinned tool registry internal/adapters/inbound/mcp/testdata/tool_registry.golden.json, which TestToolRegistryGolden compares with the server's tools/list on every test run; it was not captured from a running server. Run tools/list against a live cmd/mcp to see the same six tools.

Annotations and authority​

All six tools carry readOnlyHint: true, idempotentHint: true and openWorldHint: false. There is no write tool: the governance tests in internal/adapters/inbound/mcp/governance_test.go (TestToolSurface with its write-verb and write-seam sensors) fail on a write-named tool or a write seam, and TestMCPAdapterDependencyRule limits the adapter to the application and domain layers. A tool call adds no outbox_events row.

Every tool also declares its agent authority level L1 (Agentic Standard v2, ADR 0011): a pure read of this context's own state. The declaration travels in tools/list as _meta under the key com.warehouse/authority; the same level is pinned per tool in the golden registry and by the static sensor internal/architecture/mcp_authority_fitness_test.go. Both A2A skills carry the equivalent tag authority:L1.

ToolRequired inputOptional inputAnnotationAuthority
get_inbound_planplanIdnoneread-onlyL1
get_inbound_shipmentshipmentIdnoneread-onlyL1
get_shipment_labelsshipmentIdnoneread-onlyL1
get_seller_scorecardsellerIdwindowread-onlyL1
get_placement_planplanIdnoneread-onlyL1
list_placement_planssellerId, catalogItemIdlimitread-onlyL1

Every input schema is additionalProperties: false. The tools are bound to the same use cases as the REST GET routes. A failure is an isError tool result whose text is <slug>: <detail> with the REST slug (not-found, invalid-window, validation-failed); an untyped error is logged (mcp tool failed with an unexpected error) and answered as internal-error: an unexpected internal error occurred.

get_inbound_plan​

Reads one inbound plan.

  • Input: planId (string, required, for example pln-0f3a91).
  • Output: planId, sellerId, destinationNodeId, packingOption (INDIVIDUAL or CASE_PACKED), state (DRAFT, CONFIRMED, CANCELLED), lines (each catalogItemId, gtin, qtyEaches), createdAt, and confirmedAt and cancelledAt (string or null).
  • Errors: an unknown id is not-found.

get_inbound_shipment​

Reads one inbound shipment with its cartons.

  • Input: shipmentId (string, required, for example shp-0f3a91).
  • Output: shipmentId, planId, sellerId, nodeId, state, createdAt, labelledAt, shippedAt, receivedAt (string or null) and cartons: each with sscc, parentSscc, kind, contents (catalogItemId, gtin, qtyEaches, optional lot and expiry), grossWeightG, dimsMm (l, w, h), sealed and receiptStatus.
  • Errors: not-found.

get_shipment_labels​

Reads the label data of a shipment, one entry per carton.

  • Input: shipmentId (required).
  • Output: shipmentId, state, destinationNodeId and labels: each with labelRef (LBL-<sscc>), sscc, gs1128 (the element string (00)<sscc>), humanReadable, parentSscc, kind, contents, contentSummary, totalEaches and destinationNodeId.
  • Errors: not-found. The tool works in any shipment state, including DRAFT.

get_seller_scorecard​

Answers a seller's informational compliance scorecard (ADR 0005).

  • Input: sellerId (required, for example seller-77); window (optional, 7d or 30d, default 30d).
  • Output: sellerId, window, windowStart, windowEnd, shipmentsReceived, cartonsReported, cartonsReceived, receiptAccuracyRate (number or null: omitted when nothing was reported), discrepancyRatePerShipment (number or null: omitted when no shipment closed), discrepanciesByKind (kind to count), complianceViolations and complianceTier (GOOD, WATCH, AT_RISK).
  • Errors: an unknown seller is not-found; any other window is invalid-window. A suspended seller has a scorecard.

get_placement_plan​

Reads one placement plan (ADR 0012): the advisory that suggests, per vendor fulfilment node, how many units of one catalogue item a seller should send.

  • Input: planId (string, required, for example pl-0f3a91).
  • Output: planId, sellerId, catalogItemId, coverDays, windowDays (the observation window), basis (demand-heat-v1), state (SUGGESTED, ACCEPTED, SUPERSEDED), createdAt, acceptedAt and supersededAt (string or null) and suggestions: each with nodeId, regionId, suggestedUnits and the evidence regionDemandUnits, nodeAvailabilityUnits and coverDays. A plan with no demand has an empty suggestions list; that is a legal, recorded plan.
  • Errors: an unknown id is not-found.

list_placement_plans​

Lists the placement plans of one seller and catalogue item, newest first.

  • Input: sellerId (required, for example seller-77), catalogItemId (required, for example item-1) and limit (optional integer, 1 to 100; omitted means 50).
  • Output: {items}, each item with the same shape as get_placement_plan.

Both placement tools read the same use cases as the REST GET /placement-plans/{planId} and GET /placement-plans?sellerId=&catalogItemId=. They never compute or accept a plan: POST /placement-plans and POST /placement-plans/{planId}/acceptances are REST-only. The tool source is internal/adapters/inbound/mcp/tools_placement.go; both are pinned in internal/adapters/inbound/mcp/testdata/tool_registry.golden.json.

Transport​

The Streamable HTTP handler is stateless (ADR 0011): no Mcp-Session-Id is issued, the server answers the 2026-07-28 revision's per-request handshake (server/discover, no initialize needed) and a legacy initialize still answers 200. Nothing in the server relies on cross-call session state; pinned by the raw-POST tests in internal/adapters/inbound/mcp/stateless_test.go.

Resource: seller compliance scorecard​

warehouse://seller-inbound/scorecards/{sellerId} (application/json) is the one resource of this server: the default-window (30d) compliance scorecard of ONE seller, built from the same GetSellerScorecard read use case as the get_seller_scorecard tool and the REST GET /sellers/{sellerId}/scorecard. Bounded by construction: one seller, the scorecard's fixed fields, JSON text — never a dump of a table. A malformed URI or an unknown seller is an error.

Prompt: assess_seller_compliance​

The one prompt of this server is the operator SOP for this context: read the rolling-window scorecard, trace discrepancies to their inbound plans and shipments, and escalate AT_RISK (or repeating violations) to the human account manager. It takes one typed, required argument (sellerId); it names tools and never calls them, and nothing it names can write (the write operations of this context are REST-only). prompts/get returns the SOP text with the seller id interpolated; a missing argument degrades to a <sellerId> placeholder, never to a hidden call.

Known inconsistencies​

  • The descriptions of get_inbound_shipment (and the A2A inbound_status skill, which reuses the wording) list the shipment states PLANNED, PACKING, LABELLED, SHIPPED or RECEIVED. The aggregate's real states are DRAFT, LABELLED, SHIPPED, RECEIVING, CLOSED and CLOSED_WITH_DISCREPANCY (internal/domain/inboundshipment/shipment.go), and those are what the state field returns. The descriptions are pinned by the golden file, so correcting them is a reviewed code change.
  • cmd/mcp logs environment as dev when ENVIRONMENT is unset, while the telemetry resource says local (Configuration).