Connect Onfleet to ChatGPT: Manage Tasks, Workers, and Route Plans
from the team behind Truto
Onfleet in ChatGPT, in about a minute.
The best way to connect Onfleet to ChatGPT is Elaichi: connect Onfleet to Elaichi once, then add Elaichi to ChatGPT as a connector. Two steps, about a minute, with a 14‑day free trial and no credit card required.
- No credit card required
- 500+ connectors
- Credentials vaulted, never read back
-
Start your free trial
14 days free, no credit card required.
-
Connect Onfleet
Once, in Elaichi. ChatGPT never gets more access than you have.
-
Add Elaichi to ChatGPT
In ChatGPT, open Plugins, press +, and paste the URL into Server URL. Sign in and approve.
https://api.elaichi.ai/mcp
Building Onfleet into your own product? This guide is for you.
Connect Onfleet to ChatGPT via Truto's managed MCP server to automate fleet operations. This guide covers bypassing Onfleet API quirks, generating an MCP server via UI or API, and mapping complex workflows like bulk task creation and route optimization.
The developer guide
Learn how to connect Onfleet to ChatGPT using a managed MCP server. Automate dispatching, orchestrate route optimization, and manage delivery fleets via natural language.
If you want to connect Onfleet to ChatGPT so your AI agents can automate dispatch, assign tasks, orchestrate route optimization, and track fleet locations, you need a Model Context Protocol (MCP) server. This server acts as the critical translation layer between ChatGPT's function calls and Onfleet's complex logistics API.
If your team uses Claude, check out our guide on connecting Onfleet to Claude or explore our broader architectural overview on connecting Onfleet to AI Agents.
Giving a Large Language Model (LLM) read and write access to a last-mile delivery platform is an engineering challenge. You either spend weeks building, hosting, and maintaining a custom MCP server to map JSON arguments into Onfleet's strictly validated payloads, or you use a managed infrastructure layer.
This guide breaks down exactly how to use Truto to generate a secure, authenticated MCP server for Onfleet, connect it natively to ChatGPT, and execute complex fleet workflows using natural language.
The Engineering Reality of the Onfleet API
Building an integration layer for Onfleet requires more than just passing JSON over HTTP. The open MCP standard provides a predictable way for models to discover tools, but mapping an LLM's unpredictable output to Onfleet's API introduces specific operational hurdles.
If you build a custom MCP server, you own the entire integration lifecycle. Here are the specific challenges you will face when working with the Onfleet API:
Millisecond Unix Timestamps
Unlike many SaaS APIs that accept human-readable ISO 8601 strings, Onfleet strictly requires timestamps in Unix time in milliseconds. LLMs notoriously struggle with this. When asked to schedule a task for tomorrow, an LLM might generate a standard Unix timestamp (seconds) or an ISO string. If you don't build strict schema definitions and validation layers instructing the LLM to format time correctly, your task creation requests will fail with 400 Bad Request errors.
The 70-Second Bulk Processing Wall
When dispatching routes, operators often need to create dozens of tasks simultaneously. Onfleet's synchronous bulk_create endpoint works fine for small batches, but payloads exceeding 25 tasks often hit an internal 70-second processing timeout. Your MCP server must be intelligent enough to route large requests to Onfleet's asynchronous batch creation endpoints, capture the jobId, and instruct the LLM to poll the batch status endpoint until the tasks are ready.
Rate Limits and 429 Propagation
Onfleet enforces strict rate limits to protect its routing engine. It is crucial to understand how your infrastructure handles these. Truto does not retry, throttle, or apply backoff on rate limit errors. When the upstream Onfleet API returns an HTTP 429 (Too Many Requests), Truto passes that error directly back to the caller.
To help your agents handle this, Truto normalizes the upstream rate limit information into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) following the IETF specification. The caller (or the agent framework executing the tool) is entirely responsible for reading these headers and implementing its own retry or backoff logic.
Container Mutex and 412 Precondition Failed
In Onfleet, a "container" is the ordered task-assignment list for a worker or team. Containers have a hard limit of 10,000 tasks. More importantly, if multiple dispatch workflows attempt to update the same worker's container concurrently, Onfleet will reject the request with a 412 Precondition Failed error. Your agent workflows must be designed sequentially to avoid race conditions on worker schedules.
How to Generate an Onfleet MCP Server
Instead of building this infrastructure from scratch, you can use Truto to dynamically generate an MCP server from Onfleet's API documentation and resource definitions. Truto handles the OAuth/API key lifecycle and exposes the endpoints as ready-to-use JSON-RPC tools.
Here is how to create your server using either the Truto UI or the API.
Method 1: Via the Truto UI
- Log into your Truto dashboard and navigate to Integrated Accounts.
- Connect your Onfleet account (Truto handles the credential exchange and securely stores the API keys).
- Click into the connected Onfleet account and navigate to the MCP Servers tab.
- Click Create MCP Server.
- Select your desired configuration. You can filter by methods (e.g., only
readoperations) or tags (e.g., onlytasksandworkers). - Copy the generated MCP server URL. Treat this URL as a secret - it contains a cryptographically hashed token that authenticates requests.
Method 2: Via the Truto API
For teams building programmatic AI platforms, you can generate MCP servers on the fly via the API. First, retrieve your integrated_account_id for the Onfleet connection, then POST to the MCP endpoint:
curl -X POST https://api.truto.one/integrated-account/<INTEGRATED_ACCOUNT_ID>/mcp \
-H "Authorization: Bearer $TRUTO_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Onfleet Dispatch AI",
"config": {
"methods": ["read", "write", "custom"],
"tags": ["tasks", "workers", "route_plans"]
}
}'The response will return a fully configured MCP endpoint:
{
"id": "mcp_12345",
"name": "Onfleet Dispatch AI",
"url": "https://api.truto.one/mcp/a1b2c3d4e5f6..."
}Connecting the MCP Server to ChatGPT
Once you have your Truto MCP URL, you can connect it directly to ChatGPT. You can do this via the ChatGPT desktop/web UI or through a manual configuration file for custom local setups.
Method A: Via the ChatGPT UI
Note: Custom MCP connectors require a ChatGPT Pro, Plus, Business, Enterprise, or Education seat with Developer mode enabled.
- In ChatGPT, navigate to Settings -> Apps -> Advanced settings.
- Toggle Developer mode to the ON position.
- Under the MCP servers / Custom connectors section, click Add new server.
- Enter a descriptive name (e.g., "Onfleet Logistics").
- Paste the Truto MCP URL into the Server URL field.
- Click Add / Save.
ChatGPT will immediately ping the endpoint, perform the MCP initialization handshake, and load all the exposed Onfleet tools.
Method B: Via Manual Config File
If you are using alternative MCP clients or building a local wrapper around ChatGPT's models (such as Claude Desktop or Cursor), you can configure the connection using a standard JSON config file.
Since the Truto endpoint is a remote SSE (Server-Sent Events) connection, you use the standard MCP SSE transport command:
{
"mcpServers": {
"onfleet_truto": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sse",
"https://api.truto.one/mcp/a1b2c3d4e5f6..."
]
}
}
}If your Truto MCP server was created with the require_api_token_auth flag set to true, you must pass your Truto API token as a Bearer token in the request headers.
Hero Tools for Onfleet Operations
Truto exposes Onfleet's API surface dynamically based on available documentation. Here are the highest-leverage tools your AI agent can use to orchestrate fleet operations.
1. Create a Task (create_a_onfleet_task)
This is the foundational tool for Onfleet. It allows the LLM to generate a pickup or dropoff task. The model can pass existing destination/recipient IDs, or pass inline objects that Onfleet will automatically create during task generation.
Note: The model must provide Unix millisecond timestamps for scheduling constraints.
"Create a drop-off task for a delivery to 123 Main St, San Francisco for John Doe at 555-1234. Schedule it for tomorrow at 2 PM PST."
2. Auto-Assign Tasks (onfleet_tasks_auto_assign)
Instead of manually dragging and dropping tasks to drivers, this tool accepts an array of task IDs and automatically distributes them to available on-duty workers based on either distance or load balance.
"Take the 15 tasks created this morning and auto-assign them to our on-duty fleet, prioritizing distance-based routing."
3. Asynchronous Bulk Task Creation (onfleet_tasks_bulk_create_async)
When a dispatcher needs to import an end-of-day manifest with hundreds of stops, synchronous endpoints will time out. This tool submits up to 500 tasks asynchronously and returns a jobId that the agent can track.
"Upload this CSV manifest of 120 deliveries into Onfleet as a bulk async job, then check the job status and let me know when it finishes."
4. Create Route Plan (create_a_onfleet_route_plan)
Route plans allow you to group tasks together and schedule them as a cohesive unit. This tool requires a name, a scheduled start time, and a list of task IDs to bundle together.
"Bundle the unassigned morning pickups for the downtown zone into a new route plan starting at 8:00 AM tomorrow."
5. Start Route Optimization (onfleet_optimizations_start)
Onfleet's routing engine is highly sophisticated. After initializing an optimization job with worker constraints, max violation times, and service times, the agent uses this tool to kick off the processing algorithm.
"Initialize a route optimization for the East Coast team for tomorrow's deliveries. Cap the tasks per route at 40 and set the average service time to 5 minutes."
6. Update Worker Configuration (update_a_onfleet_worker_by_id)
Fleet managers frequently need to adjust worker status, delay times, or team assignments. This tool patches a worker's record.
"Change worker Michael's status to off-duty and reassign him from the 'North' team to the 'South' team."
7. List Worker Locations (list_all_onfleet_worker_locations)
This tool retrieves the last known GPS coordinates (longitude/latitude) and a timeLastSeen timestamp for every active worker in the organization, giving the AI agent real-time geographic context.
"Get the current locations for all on-duty drivers and tell me who is closest to the pickup task located at 4th and King St."
This is just a subset of the available operations. For the complete inventory, including schemas, exact parameter requirements, and webhooks, see the Truto Onfleet Integration Page.
Workflows in Action
Connecting Onfleet to ChatGPT allows you to map complex logistics into conversational workflows. Here is how specific personas can use these tools in production.
Workflow 1: The End-of-Day Dispatcher
At the end of a shift, a dispatcher needs to process a spreadsheet of pending orders, inject them into Onfleet, and automatically distribute them to the morning shift drivers.
"I have a list of 45 deliveries for tomorrow morning. Please upload them all to Onfleet, wait for the processing to finish, and then auto-assign them to the available drivers based on route distance."
Execution Steps:
- The agent parses the user's data and calls
onfleet_tasks_bulk_create_asyncwith an array of 45 task payloads. - Onfleet returns a batch job ID. The agent calls
onfleet_tasks_batch_job_statusin a loop until the job succeeds. - The agent retrieves the 45 newly created task IDs.
- The agent calls
onfleet_tasks_auto_assign, passing the array of task IDs and settingoptions.modetodistance. - The agent reports back to the dispatcher with the assignment breakdown and ETA estimates.
sequenceDiagram
participant User as Dispatcher
participant Agent as ChatGPT Agent
participant MCP as Truto MCP Server
participant API as Onfleet API
User->>Agent: "Upload 45 tasks & auto-assign based on distance"
Agent->>MCP: Call onfleet_tasks_bulk_create_async (Tasks)
MCP->>API: POST /tasks/batch-async
API-->>MCP: Return Job ID
MCP-->>Agent: Return Job ID
loop Check Status
Agent->>MCP: Call onfleet_tasks_batch_job_status (Job ID)
MCP->>API: GET /tasks/batch-async/:jobId
API-->>MCP: Status: Completed, Task IDs
end
Agent->>MCP: Call onfleet_tasks_auto_assign (Task IDs, mode: distance)
MCP->>API: POST /tasks/autoAssign
API-->>MCP: Assignment Results
MCP-->>Agent: Assignment Results
Agent-->>User: "Tasks assigned successfully."Workflow 2: The Reactive Logistics Coordinator
A logistics coordinator receives an urgent VIP order that needs to be injected into an already active route plan, requiring an immediate schedule update and recalculation.
"We just got a VIP rush order for 555 Market St. Create a task for it, find out which driver is currently assigned to the 'Downtown Morning' route plan, and insert this new task into their container."
Execution Steps:
- The agent calls
create_a_onfleet_taskto generate the VIP dropoff. - The agent calls
list_all_onfleet_route_plansfiltering by name for "Downtown Morning" to locate the active route plan and identify the assigned worker. - The agent calls
update_a_onfleet_container_by_idon that specific worker's container, appending the newly created VIP task ID to their active queue. - The agent confirms the new route structure with the coordinator.
Security and Access Control
When connecting powerful enterprise systems like Onfleet to LLMs, security cannot be an afterthought. Truto's MCP servers provide strict boundaries on what an agent can and cannot do.
- Method Filtering: You can restrict a server to specific operations by setting the
methodsarray during creation. Specifying["read"]limits the server togetandlistoperations, meaning the LLM can query worker locations and task status, but cannot create or delete records. - Tag Filtering: By passing
tags, you can restrict the server to specific domains. For example, filtering by["workers"]ensures the LLM can only interact with worker data, completely isolating it from destinations, webhooks, or API keys. - Extra Authentication (
require_api_token_auth): By default, an MCP server URL contains a cryptographic hash that acts as its authentication. If you are deploying in an environment where the URL might be exposed in logs, you can enablerequire_api_token_auth. This forces the client (e.g., your custom agent wrapper) to also pass a valid Truto API token in theAuthorizationheader to execute a tool. - Time-to-Live (
expires_at): For temporary workflows - such as granting an external consultant's agent temporary access to run a one-off route optimization - you can set anexpires_atISO datetime. The MCP server and all associated cached credentials will automatically self-destruct at the specified time.
Final Thoughts
Connecting Onfleet to ChatGPT transforms a static logistics dashboard into an intelligent, conversational command center. Instead of writing custom integration code to handle Onfleet's strict Unix timestamps, async batch processing limits, and complex container architectures, you can use Truto to auto-generate a secure MCP server in minutes.
By layering Truto's robust tool generation with ChatGPT's reasoning capabilities, your engineering team can focus on building intelligent dispatch logic rather than debugging integration boilerplate.
FAQ
- What is the easiest way to connect Onfleet to ChatGPT?
- The best way to connect Onfleet to ChatGPT is Elaichi: connect Onfleet to Elaichi once, then add Elaichi to ChatGPT as a connector. Two steps, about a minute, with a 14-day free trial and no credit card required.
- How does the MCP server handle Onfleet's API rate limits?
- Truto does not retry, throttle, or absorb rate limit errors. If Onfleet returns an HTTP 429, Truto passes that error directly to the caller. Truto normalizes the upstream rate limit information into standard IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset), leaving the retry and backoff implementation to your client application or agent framework.
- How do I avoid the 70-second timeout when creating multiple tasks?
- Onfleet enforces an internal 70-second timeout on synchronous bulk creations. For batches larger than 25 tasks, use the `onfleet_tasks_bulk_create_async` tool, which queues the operations asynchronously. You can then use the batch ID to check the status.
- Can I restrict ChatGPT to only read operations in Onfleet?
- Yes. When generating the MCP server in Truto, you can configure method filtering by specifying `"methods": ["read"]`. This limits the exposed tools to GET and LIST operations, preventing the model from creating or deleting data.
- Do I have to build my own MCP server for Onfleet?
- No. Truto dynamically generates a managed MCP server directly from the integration's API documentation and schemas. You simply connect your Onfleet account to Truto and generate a secure MCP URL.