Skip to main content

MCP tools

cmd/mcp serves the Model Context Protocol over Streamable HTTP only (ADR 0006): the endpoint is /mcp (port MCP_ADDR, default :8090; behind Kong /api/mcp/order-sourcing, rewritten to /mcp) and /healthz answers liveness. The root / also reaches the MCP handler. The server announces itself as order-sourcing-mcp version 1.0.0. It needs only DATABASE_URL: no Kafka, no relay, no consumer. There is no authentication, by fleet decision, and no tool that writes: TestToolSurface pins the exact set and fails the build on a write-verb name. The adapter's Deps carries usecases.Queries only, and TestMCPAdapterDependencyRule keeps it off every outbound adapter. Re-optimising an assignment stays a REST operation (POST /assignments/{id}/reoptimisations); every other lifecycle change arrives as a Kafka event.

Source: internal/adapters/inbound/mcp/server.go, tools.go, errors.go, cmd/mcp/router.go, and the registry pinned in internal/adapters/inbound/mcp/testdata/tool_registry.golden.json (names, descriptions, annotations, input and output schemas, compared byte for byte by TestToolRegistryGolden). This page was written from that code and golden file, not from a captured session.

Tool list​

ToolRead-onlyIdempotentOpen worldSame read as
list_assignmentsyes (readOnlyHint)yesnoGET /assignments, A2A find_assignments
get_assignmentyes (readOnlyHint)yesnoGET /assignments/{id}, A2A assignment_detail

Both tools call the same usecases.Queries as the REST handlers, so the data, the ordering and the validation are identical.

list_assignments​

Lists fulfillment assignments ordered by assignmentId ascending: which vendor node and path will fulfil each shipment group of a customer order, and in which state. Filters combine with AND; every input is optional (the registry has no required list for this tool, pinned by TestOptionalInputsAreNotRequired).

InputTypeRequiredMeaning
statestringnoOne of QUEUED, RELEASED, LOCKED, SHIPPED, DELIVERED, UNSOURCEABLE, CANCELLED; omitted means every state
nodeIdstringnoKeep assignments currently on this node: the candidate's node while QUEUED, the node of the latest release afterwards
orderIdstringnoKeep assignments of this order
limitintegernoPage size 1 to 500; omitted or 0 means 100

Output: {"assignments": [ ... ]} (the tool keeps its own schema), each item an assignment (shape below). An empty match is an empty array. An unknown state or a limit outside 1 to 500 fails with validation-failed. There is no cursor: the tool returns the first limit assignments by id (REST pages the same read with limit and cursor).

get_assignment​

Reads one assignment in full.

InputTypeRequiredMeaning
assignmentIdstringyesThe assignment id

Output: one assignment. An unknown id fails with not-found.

The assignment shape​

The same camelCase body as the REST Assignment schema (apis/openapi.yaml):

FieldMeaning
assignmentId, orderId, groupNoIdentity: one assignment per (orderId, groupNo)
destinationPostalPrefixThe postal prefix of the destination, never an address
stateOne of the seven states
assignmentVersionThe optimistic-concurrency version
promisepromiseId, tier (SAME_DAY, NEXT_DAY, TWO_DAY, STANDARD), deliverByLatest, witnessNodeId, revisionNo
lines[]lineNo, catalogItemId, listingId (only from the first release), quantity
candidateThe current best node and path: nodeId, pickupDepartureId, pickupCutoffAt, legs[], deliveryWaveId, eta, cost; absent when UNSOURCEABLE or CANCELLED
releaseAtThe virtual-queue release point, while QUEUED
releases[]releaseNo, nodeId, releasedAt, requiredShipBy, outcome (PENDING, ACCEPTED, REJECTED, EXPIRED), reasonCode
excludedNodes[]nodeId, reason for every node that refused the current promise revision
lockedAt, lockReason, pickupDepartureIdThe lock facts
trackingNumbers[], shippedAt, deliveredAt, cancelReasonShipment, delivery and cancel facts when they apply

Timestamps are RFC 3339 UTC strings; unset optional fields are omitted. No PII is held by this context.

Errors​

A tool failure is returned as an MCP tool result with isError set and a text of the form <slug>: <detail> (never a protocol error), using the REST problem slugs: not-found, validation-failed. Any other failure is logged with the trace id and reported as internal-error: an unexpected internal error occurred, so DSNs and SQL never reach the model.

Trying it​

The first calls are on the Quickstart. A raw JSON-RPC request needs both accept types (Accept: application/json, text/event-stream); an MCP SDK client is easier. The server instructions announced at initialize say the surface is read-only and name both tools.

The sibling read surface for agents is A2A, described on the API overview.