Traveler Duty of Care · 09 / 26

Tool and API (Application Programming Interface) Contracts

The tool catalogue and contracts of the traveler duty of care platform: OpenAPI and MCP (Model Context Protocol) definitions, error model, idempotency, contract tests and what AI (artificial intelligence) may never call.

Why contracts come first

The tools are the only way the advisory and documentation components can touch travel systems. 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.

The tool catalogue

ToolPurposeChanges dataSafe to retryScopeNeeds approval
get_incident_summaryRead incident facts with no names or locationsNoYesincident.readNo
get_incident_statusRead muster counts and statusNoYesmuster.readNo
get_event_detailsRead a risk event's area, time and sourceNoYesevent.readNo
get_trip_countsRead counts of travelers by country and dayNoYestrips.readNo
search_policiesRetrieve policies and templates with citation and versionNoYesknowledge.readNo
propose_severityRecord an advisory severity assessmentYes, a proposal onlyYes, by keyseverity.proposeThe duty officer decides
draft_incident_reportCreate a draft incident report from structured factsYes, a draft onlyYes, by keyreport.draftThe officer signs before filing
draft_traveler_guidanceCreate draft guidance text for reviewYes, a draft onlyYes, by keyguidance.draftThe officer approves before any use
draft_lessonsCreate a draft lessons-learned noteYes, a draft onlyYes, by keylessons.draftThe security director reviews
file_reportFile a report to the recordYesYes, by keyreport.fileSignature required; not callable by AI
send_custom_alertSend non-template text to travelersYesYes, by keyalert.customOfficer approval; not callable by AI
close_incidentClose an incidentYesYes, by keyincident.closeOfficer only, blocked while travelers are unresolved; not callable by AI

An operation, in OpenAPI

Proposing a severity 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 traveler list, a message or a decision.

travel-duty-tools.openapi.yaml · excerpt
openapi: 3.1.0
info: { title: Travel duty of care tools, version: 1.2.0 }
paths:
  /incidents/{incident_id}/severity-proposals:
    post:
      operationId: propose_severity
      summary: Record an advisory severity assessment. A proposal only: it sends nothing, closes nothing and cannot name travelers.
      parameters:
        - { name: incident_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, severity, uncertainty, evidence]
              properties:
                model_version: { type: string }
                severity:      { type: string, enum: [low, medium, high, critical] }
                uncertainty:   { type: number, minimum: 0, maximum: 1 }
                evidence:      { type: array, description: Pointers to the event records and sources used, items: { type: string } }
      responses:
        "201": { description: Recorded as advice for the duty officer }
        "200": { description: Same Idempotency-Key replayed; returns the original proposal }
        "422": { description: Missing uncertainty, or an attempt to include travelers, messages or decisions }
        "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 names or locations and read-only hints.

get_incident_status · MCP tool definition
{
  "name": "get_incident_status",
  "description": "Read an incident's muster counts and status. Read only. No names and no locations.",
  "inputSchema": {
    "type": "object",
    "required": ["incident_id"],
    "properties": {
      "incident_id": { "type": "string" },
      "include": { "type": "array", "maxItems": 3,
                   "items": { "enum": ["status", "muster_counts", "open_count"] } }
    }
  },
  "annotations": { "readOnlyHint": true, "idempotentHint": true }
}

Error model

CodeMeaningWhat the platform does
invalid_argumentA field failed validationRoute to an officer with the reason; never retry unchanged
not_foundIncident, event or report unknownCheck the identifier; do not guess
conflictA report already signed or filed, or an incident closedRe-read state; never overwrite a signed record
forbiddenScope or signature check failedDo not retry; route to a person; raise a security event
rate_limitedToo many callsBack off, then queue
unavailableBackend down or timed outRetry once with the same key, then fall back to manual documentation

Rules every tool follows

  1. Idempotency

    Every write takes an idempotency key. A replay returns the original result and never creates a second one.

  2. Propose, never decide

    AI-facing writes create proposals and drafts. Sending, closing, filing and approving are acts of a named person with strong authentication.

  3. Uncertainty always

    A proposal without a stated uncertainty and its evidence is refused.

  4. Versioning

    Contracts are versioned. A breaking change is a new major version, run side by side until the evaluation set passes on it.

  5. Audit

    Each call writes an audit record with the arguments hash, the caller, the model version, the outcome and the trace identifier.

A lost response, a safe retry and a refused traveler list A severity proposal is recorded but the response is lost. The service retries once with the same idempotency key and receives the original proposal. A separate attempt to include traveler names in a proposal is refused and audited. Risk advisor Travel gateway Incident store Audit log propose_severity, key K1 check scope, uncertainty, evidence store proposal, key K1 proposal P-318 recorded response lost: timeout unavailable retry once, same key K1 propose_severity, key K1 store, key K1 key seen: return original P-318, 200 P-318 propose_severity with traveler names traveler data is not accepted audit: refused unprocessable
A lost response, a safe retry and a refused traveler list

Contract tests

Build this for your business

This example is speculative, but the same pattern, minimal and consented data, deterministic rules for every safety duty, a governed gateway, runtime security, advisory-only AI and accountable people, fits any service that looks after people. We can scope a pilot on your own systems.

Book a discovery call