Why contracts come first
The tools are the only way the advisory and documentation components can touch mission records. Their contracts are the stable layer: the Microsoft Foundry build and the LangGraph build both call the same operations, and the evaluation set checks the same arguments. A strict contract makes the system testable and limits what a manipulated model can do.
- Arguments are typed, bounded and validated by the ground gateway, never trusted from the model.
- Every tool declares whether it changes anything, whether it is safe to retry and what scope it needs.
- AI-facing tools can read and propose. Signing a plan, approving a burn, releasing a shipment and filing a report are acts of a named person.
- No tool, and no path from any tool, can send a command to a vehicle. The uplink is not reachable from the AI side.
The tool catalogue
| Tool | Purpose | Changes data | Safe to retry | Scope | Needs approval |
|---|---|---|---|---|---|
| get_campaign_summary | Read campaign facts without buyer data | No | Yes | campaign.read | No |
| get_survey_product | Read survey product pointers and metadata | No | Yes | survey.read | No |
| get_ledger_status | Read mass ledger status | No | Yes | ledger.read | No |
| get_vehicle_status | Read vehicle mode, health and last heartbeat | No | Yes | vehicle.read | No |
| search_procedures | Retrieve procedures and licence terms with citation and version | No | Yes | knowledge.read | No |
| propose_sites | Record an advisory site ranking with uncertainty | Yes, a proposal only | Yes, by key | site.propose | Engineers review and a director signs |
| draft_shift_report | Create a draft shift report from structured facts | Yes, a draft only | Yes, by key | report.draft | An engineer signs before filing |
| draft_notification | Create a draft regulator notification | Yes, a draft only | Yes, by key | notice.draft | The compliance officer files |
| draft_handover_note | Create a draft handover note | Yes, a draft only | Yes, by key | note.draft | A person reviews |
| file_report | File a report to the record | Yes | Yes, by key | report.file | Signature required; not callable by AI |
| sign_plan | Sign a plan and its envelope | Yes | Yes, by key | plan.sign | Director only; not callable by AI |
| release_shipment | Release a shipment | Yes | Yes, by key | shipment.release | Director approval; not callable by AI |
An operation, in OpenAPI
Proposing sites is the most consequential AI-facing write, and it is only a proposal. The operation requires an idempotency key, model version, uncertainty and evidence, and refuses anything that looks like a vehicle command.
openapi: 3.1.0
info: { title: Mining planning tools, version: 1.2.0 }
paths:
/campaigns/{campaign_id}/site-proposals:
post:
operationId: propose_sites
summary: Record an advisory site ranking. A proposal only: it changes nothing and cannot be sent to any vehicle.
parameters:
- { name: campaign_id, in: path, required: true, schema: { type: string } }
- { name: Idempotency-Key, in: header, required: true, schema: { type: string, minLength: 16 } }
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [model_version, ranking, uncertainty, evidence]
properties:
model_version: { type: string }
ranking: { type: array, description: Site ids in rank order, items: { type: string } }
uncertainty: { type: array, description: Per-site uncertainty as a fraction, items: { type: number, minimum: 0, maximum: 1 } }
evidence: { type: array, description: Pointers to the survey products used, items: { type: string } }
responses:
"201": { description: Recorded as a proposal for the engineers }
"200": { description: Same Idempotency-Key replayed; returns the original proposal }
"422": { description: Ranking missing uncertainty, or an attempt to include vehicle commands }
"403": { description: Caller scope failed }A read tool, as an MCP definition
The platform sees tools through the Model Context Protocol. The definition repeats the constraints that matter: required fields, an enumerated list of what to include, no buyer data and read-only hints.
{
"name": "get_ledger_status",
"description": "Read mass ledger status for a batch or campaign. Read only. No buyer or price data.",
"inputSchema": {
"type": "object",
"required": ["campaign_id"],
"properties": {
"campaign_id": { "type": "string" },
"include": { "type": "array", "maxItems": 3,
"items": { "enum": ["status", "gap_pct", "open_batches"] } }
}
},
"annotations": { "readOnlyHint": true, "idempotentHint": true }
}Error model
| Code | Meaning | What the platform does |
|---|---|---|
| invalid_argument | A field failed validation | Route to an engineer with the reason; never retry unchanged |
| not_found | Campaign, product or batch unknown | Check the identifier; do not guess |
| conflict | A plan or report already signed or filed | Re-read state; never overwrite a signed record |
| forbidden | Scope or signature check failed | Do not retry; route to a person; raise a security event |
| rate_limited | Too many calls | Back off, then queue |
| unavailable | Backend down or timed out | Retry once with the same key, then fall back to manual documentation |
Rules every tool follows
Idempotency
Every write takes an idempotency key. A replay returns the original result and never creates a second one.
Propose, never decide
AI-facing writes create proposals and drafts. Signing, approving, releasing and filing are acts of a named person with strong authentication.
Uncertainty always
A proposal without a stated uncertainty and its evidence is refused.
Versioning
Contracts are versioned. A breaking change is a new major version, run side by side until the evaluation set passes on it.
Audit
Each call writes an audit record with the arguments hash, the caller, the model version, the outcome and the trace identifier.
Contract tests
- Every tool definition validates against the schema and has an owner, a scope and a retry rule.
- Property tests send out-of-range, oversized and malformed arguments and expect invalid_argument, never a partial write.
- A replay test sends each write twice with the same key and expects one result.
- A reachability test proves that no AI-facing credential or route can reach the uplink or any vehicle.
- The Foundry build and the LangGraph build run the same contract suite against a mock backend.
Build this for your business
This example is speculative and describes no real mission, but the same pattern, deterministic safety for every hard duty, a governed gateway, runtime security, advisory-only AI and measured quality, fits any remote, high-consequence operation. We can scope a pilot on your own systems.
Book a discovery call