---
title: "Connect Onfleet to ChatGPT: Manage Tasks, Workers, and Route Plans"
slug: connect-onfleet-to-chatgpt-manage-tasks-workers-and-route-plans
date: 2026-10-07
author: Nachi Raman
categories: ["AI & Agents"]
excerpt: "Learn how to connect Onfleet to ChatGPT using a managed MCP server. Automate dispatching, orchestrate route optimization, and manage delivery fleets via natural language."
tldr: "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."
canonical: https://truto.one/blog/connect-onfleet-to-chatgpt-manage-tasks-workers-and-route-plans/
---

# Connect Onfleet to ChatGPT: Manage Tasks, Workers, and Route Plans

**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.

1. **Start your free trial.** Create your Elaichi account. 14 days free, no credit card required.
2. **Connect Onfleet.** Connect Onfleet once in Elaichi. ChatGPT never gets more access than you have.
3. **Add Elaichi to ChatGPT.** In ChatGPT, open Plugins, press +, and paste https://api.elaichi.ai/mcp into Server URL. Sign in and approve.

[Start free on Elaichi, 14 days, no credit card required](https://app.elaichi.ai/signup?utm_source=truto.one&utm_medium=referral&utm_campaign=launchpad&utm_content=post_markdown&utm_term=onfleet) · [Onfleet on Elaichi](https://elaichi.ai/connectors/onfleet/?utm_source=truto.one&utm_medium=referral&utm_campaign=launchpad&utm_content=post_markdown&utm_term=onfleet)

*Building Onfleet into your own product? The guide below is for you.*

---

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)](https://truto.one/what-is-mcp-model-context-protocol-the-2026-guide-for-saas-pms/) 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](https://truto.one/connect-onfleet-to-claude-orchestrate-delivery-and-fleet-logistics/) or explore our broader architectural overview on [connecting Onfleet to AI Agents](https://truto.one/connect-onfleet-to-ai-agents-automate-orders-and-dispatch-workflows/).

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](https://truto.one/how-to-build-mcp-servers-for-ai-agents-2026-hands-on-architecture-guide/) 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.

> Stop writing boilerplate API integration code. Let Truto generate secure, managed MCP servers for your AI agents in seconds.
>
> [Talk to us](https://truto.one/book-a-demo/)

## 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](https://truto.one/what-is-mcp-model-context-protocol-the-2026-guide-for-saas-pms/) 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

1. Log into your Truto dashboard and navigate to **Integrated Accounts**.
2. Connect your Onfleet account (Truto handles the credential exchange and securely stores the API keys).
3. Click into the connected Onfleet account and navigate to the **MCP Servers** tab.
4. Click **Create MCP Server**.
5. Select your desired configuration. You can filter by methods (e.g., only `read` operations) or tags (e.g., only `tasks` and `workers`).
6. 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:

```bash
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:

```json
{
  "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](https://truto.one/bring-100-custom-connectors-to-chatgpt-with-superai-by-truto/). 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.*

1. In ChatGPT, navigate to **Settings -> Apps -> Advanced settings**.
2. Toggle **Developer mode** to the ON position.
3. Under the **MCP servers / Custom connectors** section, click **Add new server**.
4. Enter a descriptive name (e.g., "Onfleet Logistics").
5. Paste the Truto MCP URL into the **Server URL** field.
6. 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:

```json
{
  "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](https://truto.one/integrations/detail/onfleet).

## 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:**
1. The agent parses the user's data and calls `onfleet_tasks_bulk_create_async` with an array of 45 task payloads.
2. Onfleet returns a batch job ID. The agent calls `onfleet_tasks_batch_job_status` in a loop until the job succeeds.
3. The agent retrieves the 45 newly created task IDs.
4. The agent calls `onfleet_tasks_auto_assign`, passing the array of task IDs and setting `options.mode` to `distance`.
5. The agent reports back to the dispatcher with the assignment breakdown and ETA estimates.

```mermaid
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:**
1. The agent calls `create_a_onfleet_task` to generate the VIP dropoff.
2. The agent calls `list_all_onfleet_route_plans` filtering by name for "Downtown Morning" to locate the active route plan and identify the assigned worker.
3. The agent calls `update_a_onfleet_container_by_id` on that specific worker's container, appending the newly created VIP task ID to their active queue.
4. 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 `methods` array during creation. Specifying `["read"]` limits the server to `get` and `list` operations, 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 enable `require_api_token_auth`. This forces the client (e.g., your custom agent wrapper) to also pass a valid Truto API token in the `Authorization` header 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 an `expires_at` ISO 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.
