Skip to content

assign_provider

Status: Implemented | Module: trip

Assign a transportation provider to a created trip. Use AFTER list_trip_providers to attach the correct provider (e.g. Mileage Reimbursement Virginia for MR trips). The tp_id must be present in the TP candidate cache for this session_id + trip_id (10 min TTL) — unknown IDs are rejected. For roundtrips, call assign_provider separately for each leg using each leg’s trip_id.

Hint Value
readOnlyHint false
destructiveHint false
idempotentHint true
Field Type Required Description
session_id string yes Active session ID from verify_member
trip_id string yes Trip UUID or friendly_id (from confirm_trip)
tp_id string yes Provider UUID from list_trip_providers
Field Type Description
trip_id string Resolved trip UUID
tp_id string Provider UUID that was assigned
status string assigned on success
message string Human summary
revived bool Set when the SDK reports the trip was revived from a prior terminal state
  • tp_id must be in the candidate cache for this session_id + trip_id. Unknown tp_id surfaces as: unknown tp_id <id> — call list_trip_providers first and use a tp_id from the result.
  • Trip ownership is verified against the session’s org_id (defense in depth).
  • Candidate-cache read failures degrade gracefully (logged, call proceeds).
  • Loads session + validates trip ownership.
  • Calls the nemt-trip-service TP assignment endpoint.
  • Emits a HIPAA audit entry mcp.assign_provider with trip_id, tp_id, revived, and a sanitized reason on denial. Outcome is allowed or denied.
  • Source: internal/app/trip/usecases/assign_provider.go, internal/app/trip/adapters/mcp/handlers/assign_provider.go
  • Prerequisite: list_trip_providers (produces the valid tp_id set)