File size: 5,263 Bytes
8319422
 
 
 
 
 
 
 
 
 
b166fd2
8319422
 
b166fd2
8319422
 
5625fed
 
8319422
f5c663f
8319422
 
 
 
 
 
 
5625fed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8319422
 
 
5625fed
8319422
 
5625fed
 
 
 
8319422
 
 
 
 
5625fed
 
b166fd2
 
 
5625fed
 
 
 
 
 
8319422
5625fed
 
 
 
 
 
b166fd2
 
 
 
 
 
5625fed
b166fd2
5625fed
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# FleetMind MCP Tools - Quick Reference

## Geocoding & Routing (3 tools)

1. **`geocode_address`** - Convert address to GPS coordinates
2. **`calculate_route`** - Calculate route with vehicle-specific optimization (motorcycle/car/bicycle), toll avoidance, traffic data
3. **`calculate_intelligent_route`** - Advanced routing with weather + traffic + vehicle type analysis

## Order Management (8 tools)

4. **`create_order`** - Create new delivery order with **MANDATORY expected_delivery_time** and SLA tracking
5. **`count_orders`** - Count orders by status (pending/assigned/in_transit/delivered)
6. **`fetch_orders`** - Get list of orders with filters and pagination
7. **`get_order_details`** - Get full details of specific order by ID including timing and SLA data
8. **`search_orders`** - Search orders by customer name, address, or order ID
9. **`get_incomplete_orders`** - Get all pending/assigned/in_transit orders
10. **`update_order`** - Update order status, driver, location, notes (with assignment cascading)
11. **`delete_order`** - Delete order (with active assignment checks)

## Driver Management (8 tools)

12. **`create_driver`** - Register new driver with name, phone, vehicle type
13. **`count_drivers`** - Count drivers by status (active/busy/offline)
14. **`fetch_drivers`** - Get list of drivers with filters and pagination
15. **`get_driver_details`** - Get full details of specific driver by ID
16. **`search_drivers`** - Search drivers by name, phone, or driver ID
17. **`get_available_drivers`** - Get all active drivers ready for assignment
18. **`update_driver`** - Update driver status, phone, vehicle type, location (with assignment validation)
19. **`delete_driver`** - Delete driver (with assignment safety checks)

## Assignment Management (6 tools)

20. **`create_assignment`** - Assign order to driver (validates status, calculates route, saves all data)
21. **`get_assignment_details`** - Get assignment details by assignment ID, order ID, or driver ID
22. **`update_assignment`** - Update assignment status with cascading updates to orders/drivers
23. **`unassign_order`** - Unassign order from driver (reverts statuses, requires confirmation)
24. **`complete_delivery`** - Mark delivery complete and auto-update driver location to delivery address
25. **`fail_delivery`** - Mark delivery as failed with MANDATORY driver location and failure reason

## Bulk Operations (2 tools)

26. **`delete_all_orders`** - Bulk delete all orders (or by status filter, blocks if active assignments exist)
27. **`delete_all_drivers`** - Bulk delete all drivers (or by status filter, blocks if assignments exist)

---

## Total: 27 MCP Tools

**Routing Tools:** 3 (with Google Routes API integration)
**Order Tools:** 8 (full CRUD + search + cascading)
**Driver Tools:** 8 (full CRUD + search + cascading)
**Assignment Tools:** 6 (complete assignment lifecycle + delivery completion + failure handling)
**Bulk Operations:** 2 (efficient mass deletions with safety checks)

### Key Features:
- βœ… Real-time traffic & weather-aware routing
- βœ… Vehicle-specific optimization (motorcycle/bicycle/car/van/truck)
- βœ… Toll detection & avoidance
- βœ… Complete fleet management (orders + drivers + assignments)
- βœ… Assignment system with automatic route calculation
- βœ… **Mandatory delivery deadline (expected_delivery_time) when creating orders**
- βœ… **Automatic SLA tracking with grace period**
- βœ… **Delivery performance status: on_time, late, very_late, failed_on_time, failed_late**
- βœ… **Automatic driver location updates on delivery completion**
- βœ… **Mandatory location + reason tracking for failed deliveries**
- βœ… **Structured failure reasons for analytics and reporting**
- βœ… Cascading status updates (order β†’ assignment β†’ driver)
- βœ… Safety checks preventing invalid deletions/updates
- βœ… PostgreSQL database with foreign key constraints
- βœ… Search & filtering capabilities
- βœ… Status tracking & validation

### Assignment System Capabilities:
- **Manual assignment** with validation (pending orders + active drivers only)
- **Automatic route calculation** from driver location to delivery address
- **Delivery completion** with automatic driver location update to delivery address
- **SLA & Timing Tracking**:
  - Mandatory `expected_delivery_time` when creating orders
  - Automatic comparison of actual vs expected delivery time
  - Grace period support (default: 15 minutes)
  - Performance statuses: `on_time`, `late` (within grace), `very_late` (SLA violation)
  - `delivered_at` field automatically populated on completion/failure
- **Delivery failure handling** with mandatory GPS location and failure reason
- **Failure timing tracking**: `failed_on_time` vs `failed_late` status
- **Structured failure reasons**: customer_not_available, wrong_address, refused_delivery, damaged_goods, payment_issue, vehicle_breakdown, access_restricted, weather_conditions, other
- **Status management** with cascading updates across orders/drivers/assignments
- **Safety checks** preventing deletion of orders/drivers with active assignments
- **Assignment lifecycle**: active β†’ in_progress β†’ completed/failed/cancelled
- **Database integrity** via FK constraints (ON DELETE CASCADE/RESTRICT/SET NULL)