{
  "schema_version": "v1",
  "name": "ownroute",
  "description": "Vehicle routing optimization. Assigns N jobs to M drivers and returns ordered routes with ETAs.",
  "version": "1.0.0",
  "server": {
    "url": "https://api.ownroute.org/mcp",
    "transport": "http"
  },
  "auth": {
    "type": "bearer",
    "header": "Authorization",
    "signup_url": "https://ownroute.org/signup?plan=agent"
  },
  "tools": [
    {
      "name": "ownroute.optimize",
      "description": "Assign delivery jobs to drivers and return ordered routes with ETAs.",
      "input_schema": {
        "type": "object",
        "required": ["job_ids", "driver_ids"],
        "properties": {
          "job_ids":    { "type": "array", "items": { "type": "string" }, "minItems": 1, "maxItems": 1000 },
          "driver_ids": { "type": "array", "items": { "type": "string" }, "minItems": 1, "maxItems": 200 },
          "options": {
            "type": "object",
            "properties": {
              "shift_start":          { "type": "string", "format": "date-time" },
              "shift_end":            { "type": "string", "format": "date-time" },
              "max_stops_per_driver": { "type": "integer", "minimum": 1 },
              "objective":            { "type": "string", "enum": ["min_duration", "min_distance", "balanced"] },
              "seed":                 { "type": "integer", "minimum": 0 }
            }
          }
        }
      }
    },
    {
      "name": "ownroute.create_job",
      "description": "Create a delivery job.",
      "input_schema": {
        "type": "object",
        "required": ["dropoff_lat", "dropoff_lng"],
        "properties": {
          "external_id":     { "type": "string" },
          "dropoff_lat":     { "type": "number" },
          "dropoff_lng":     { "type": "number" },
          "dropoff_address": { "type": "string" },
          "service_minutes": { "type": "integer", "minimum": 0, "default": 5 },
          "priority":        { "type": "integer", "minimum": 1, "maximum": 10, "default": 1 },
          "window_start":    { "type": "string", "format": "date-time" },
          "window_end":      { "type": "string", "format": "date-time" }
        }
      }
    },
    {
      "name": "ownroute.list_jobs",
      "description": "List jobs in the account, paginated.",
      "input_schema": {
        "type": "object",
        "properties": {
          "status": { "type": "string", "enum": ["pending", "assigned", "in_transit", "completed", "failed", "cancelled"] },
          "limit":  { "type": "integer", "minimum": 1, "maximum": 200, "default": 50 },
          "cursor": { "type": "string" }
        }
      }
    },
    {
      "name": "ownroute.cancel_job",
      "description": "Cancel a job that has not completed.",
      "input_schema": {
        "type": "object",
        "required": ["job_id"],
        "properties": { "job_id": { "type": "string" } }
      }
    },
    {
      "name": "ownroute.create_driver",
      "description": "Register a driver.",
      "input_schema": {
        "type": "object",
        "required": ["name"],
        "properties": {
          "external_id":         { "type": "string" },
          "name":                { "type": "string" },
          "phone":               { "type": "string" },
          "start_lat":           { "type": "number" },
          "start_lng":           { "type": "number" },
          "max_concurrent_jobs": { "type": "integer", "minimum": 1, "default": 8 }
        }
      }
    },
    {
      "name": "ownroute.list_drivers",
      "description": "List drivers in the account.",
      "input_schema": {
        "type": "object",
        "properties": {
          "active": { "type": "boolean" },
          "limit":  { "type": "integer", "minimum": 1, "maximum": 200, "default": 50 },
          "cursor": { "type": "string" }
        }
      }
    }
  ]
}
