edit_trip
Status: Implemented | Module: trip
Edit an active trip. Six fields are editable: pickup_address, dropoff_address, pickup_time, appointment_time, note, driver_note. At least one change must be supplied. Edits are applied independently — the response reports per-field success/failure as success, partial, or failed.
Call get_trip_status first to confirm editable=true and to obtain the pickup_stop_id / dropoff_stop_id needed for address and time updates.
Annotations
Section titled “Annotations”| Hint | Value |
|---|---|
| readOnlyHint | false |
| destructiveHint | false |
| idempotentHint | false |
| Field | Type | Required | Description |
|---|---|---|---|
session_id |
string | yes | Active session ID from verify_member |
trip_id |
string | yes | Trip UUID or friendly_id |
pickup_address |
string | no | New pickup address (full string) |
dropoff_address |
string | no | New dropoff address |
pickup_time |
string | no | New pickup time (YYYY-MM-DD HH:MM, seconds also accepted) |
appointment_time |
string | no | New appointment time (YYYY-MM-DD HH:MM) |
note |
string | no | Updated trip note (empty string clears) |
driver_note |
string | no | Updated driver-specific note (empty string clears) |
Only trips with an active status (see get_trip_status editable set) can be edited. Cancelled/finished/denied/deleted trips are rejected.
Output
Section titled “Output”| Field | Type | Description |
|---|---|---|
trip_id |
string | Trip UUID |
friendly_id |
string | Friendly ID |
changes_applied |
string[] | Names of fields that applied successfully |
errors |
string[] | Per-field failure messages (omitted when none) |
status |
string | success (all applied), partial (mixed), or failed (no change applied) |
Partial Apply Semantics
Section titled “Partial Apply Semantics”Each supplied field is attempted independently:
- Address updates require the trip’s corresponding
stop_id(PickupStopID/DropoffStopID). A missing stop_id becomes an error entry, not a hard failure. - Address updates are now geocoded via the injected geocoder before being written (v2.0 fix — previously stops were updated with empty
lat/lonwhich broke ETA recompute). The geocoder also populatesplace_id,formatted_address, andplace_nameso the downstream stop carries the same shape as a freshly-resolved stop. Geocoder failure surfaces as a per-field error rather than a hard failure. - Time updates parse
YYYY-MM-DD HH:MM(with or without seconds). Local time is used; trip-service reinterprets in the trip’s timezone. noteanddriver_noteupdate in a single call — passing either updates the row.
If every supplied field fails, the use case returns an error (tool surfaces a failed status). Any single success yields partial or success.
Side Effects
Section titled “Side Effects”- Loads and validates session + trip ownership against
org_id. - Writes via the nemt-trip-service edit interface.
- Emits a HIPAA audit entry
mcp.edit_trip— metadata capturesedited_fields(names only),changes_applied_count, anderrors_count. Addresses, times, and note contents are never logged or audited.
Related
Section titled “Related”- Source:
internal/app/trip/usecases/edit_trip.go,internal/app/trip/adapters/mcp/handlers/edit_trip.go - Prerequisite: get_trip_status (to confirm editable + get stop IDs)