request_route #

View this page as Markdown

On this page

Generated automatically from the published contract sources.

A script calls this action over HTTPS at POST https://tzcloud.dev.turnzero.ai/v1/request_route, with a bearer credential and the action's payload as the JSON body. An MCP connection lists this action as the tool tzcloud_request_route.

OAuth access tokens and minted tokens, including the turnzero command's computer token, are bearer credentials. The action determines which kinds, scopes and grants it accepts (Sign-in, sessions, and tokens).

Build metadata: Registered in this build. Registration describes the default dispatcher in this build. It does not guarantee that a caller has the required credential or grant, that a tool is listed for that connection, or that the required service is configured.

Contract description #

Request a deployed route with HTTP GET if your shell cannot reach it, using write_route for other methods.

An omitted environment defaults to production. With test_end_user, it is required. test_end_user supplies a temporary session. session_as bearer sends it as a bearer token. Without a session, a 401 on invited or workforce routes outside session-free paths may be the router's gate.

A GET that changes data still has those effects. The production consent and retry rules for write_route apply.

More about this action #

The platform builds the address from the environment's own hostname under the platform's serving suffix. The path cannot change the host, and a path that opens with // is refused invalid_request. The platform resolves the hostname and connects only to a public address it checked. A hostname that resolves to an address outside public unicast is refused route_unreachable before any connection.

The call follows up to five redirects to the same HTTPS hostname on port 443 and checks the address each time. Set follow_redirects: false to return the first redirect's status and location. Redirects to other hosts, ports or schemes are returned as received.

The request sends your headers, and the HTTP client's defaults where you set none. It sends no header or credential of the platform's. The accept-encoding header is always identity, and a body the application encodes anyway comes back decoded. You may set at most 16 headers. Setting accept-encoding, a hop header, or a header in one of the platform's own header families is refused invalid_request, and the detail gives the header. The one name of those families you may set is x-turnzero-cloud-client, the app's client-version header: it reaches your application as sent, so a route check meets a native client's version gate as the client does.

The body comes back as text where it is UTF-8, and in base64 otherwise; body_encoding says which. The body returned is at most 64 KiB, counted after any decoding. Past that, the connection ends and truncated is true. Pass max_body_bytes to lower that bound, down to 0 for the status and headers alone, so a large page fits your tool's output limit. The call ends within 20 seconds, or it is refused route_unreachable with the reason timeout. The account's shared limit for request_route and write_route is 60 requests per clock minute. Each routes entry counts as one request before the limit is checked; a rate_capped call's entries still count. Above the limit, the call is refused rate_capped. The refusal gives no retry time; wait for the next clock minute before calling again.

Where the platform's router relayed the response, its headers include x-request-id, the router's identifier for the request. Your application also receives it, as the request header x-request-id. For a status of 400 or more, the answer's detail gives a read_logs call: field: "request_id", that identifier as value, since, wait_seconds, and no source. Use it for an unexpected status. A 4xx matching expect still carries the pointer, but a deliberately requested status needs no log read. One read returns a 5xx's router record and your code's entries that carry it. For a 5xx, the call points to the log read instead of making it, so the probe returns without waiting for logs and its answer stays small.

A router replica writes at most twenty such records a minute for an environment. A whole router record reaches a read within a few seconds, which the detail's ten-second wait covers. The lines your code writes include the identifier only where your code writes it. To find your own log entry by a field such as request_id, read the app source with that field and value. From the same start, container reads server console lines and pool reads function lines. A static site has no function console. contains matches the request ID only where your code prints it.

With test_end_user, Cloud signs in the test user under sign_in_test_end_user's rules. By default its cookie goes with the request and same-host redirects. Cloud tries to close the session at the end of the call. If closing fails, it expires on its own. Cloud masks the unencoded session value in the reply's URL, headers and body, including its set-cookie header. Keep session values out of app replies and logs, including encoded copies. Each call counts against code_sends_per_hour for the test email, five an hour by default. Beyond that it returns signin_code_rate_limited. It also counts against the realm's signin_starts_per_hour for your network address, thirty an hour by default. Beyond that it returns signin_rate_limited. Leave out the cookie header, or the call returns invalid_request.

session_as selects how request_route or write_route sends that session: cookie by default, or bearer as Authorization: Bearer <value> with no cookie. Either form rides the request and each same-host redirect. With bearer, your own authorization header is refused invalid_request. A session_as without test_end_user, or any value other than cookie or bearer, is refused invalid_request before any request.

Use routes to send one to five requests in order. With test_end_user, one sign-in serves the list. Each entry gives path, with optional headers, expect and follow_redirects. results has one result per request. A network refusal appears in that result and the next request can still run. Each request gets up to 20 seconds within the 60-second batch. Unsent entries return timeout results if the batch expires. Each response body is limited to 12 KiB. Each entry counts toward the shared limit of 60 requests per clock minute.

With routes, failed counts results refused with route_unreachable and those returning a status other than the one the request expects. That is a status differing from expect, or 400 or more when the request gives none. A request may carry expect, an integer status from 100 to 599. Set it to 404 or 401 to check that status without counting a matching result as failed. Its result then carries expected: true when the status matches and false otherwise, including a refused result. invalid_request refuses the whole call.

A GET your code handles as a write still changes its data, and the call does not stop it. Check a route whose effect you do not know before treating it as a read. For a GET that writes in production, follow the same consent rules as write_route. If a timeout or lost reply leaves a write's outcome unclear, check the result before repeating it. After a deploy, the deploy skill checks each changed read route and checks writes under its real users and test-app rules. Requesting development before it is created returns environment_not_created. An existing environment that serves no version refuses never_deployed. The platform's record of the call keeps the method and the path without its query, and never the headers.

Pass the application's id, not its name or label, and the path, such as /health; without environment, the request goes to production. Read that id from start or list_applications. method is GET where you give none, and GET is the one value it takes. Any other method, or a body, at the top level or in a routes entry, is refused invalid_request, and the detail points to write_route, which sends POST, PUT, PATCH, and DELETE.

The path argument: for example /health or /orders?limit=5, at most 2,048 characters with its query. Percent-encode a space.

For an invited or workforce audience, outside the session-free paths, the router admits the request only with an end user's session. Without it, a 401 may prove only the router's gate, not the route's behaviour. Use test_end_user for a temporary session, and session_as bearer for a bearer-only route. session_as is cookie by default and stays at the top level with test_end_user when you pass routes. For ordinary reads, omitting environment selects production. test_end_user requires the environment explicitly. Put expect inside an entry of routes, never at the top level. A request whose accept includes text/html is redirected to the sign-in page instead of receiving that 401; the call follows the same-host redirect by default.

You cannot set host, content-length, accept-encoding, a hop header, or a name under the platform's header families. Those families are x-forwarded-, x-azure-, x-fd-, x-envoy-, x-k8se-, x-ms-containerapp-, x-turnzero-cloud- apart from x-turnzero-cloud-client, and x-app-cloud-.

Access and action metadata #

{
  "name": "request_route",
  "resource": "environment",
  "tier": "reversible",
  "surface": "tzcloud",
  "addresses": [
    "tzcloud"
  ],
  "product": "cloud",
  "summary": "Make one HTTP `GET` request to a route of your own deployed application and read what it returns: the status, the headers, and the body. Call it after a deploy, from a tool with no shell, for each changed route that reads. To send `POST`, `PUT`, `PATCH`, or `DELETE`, call `write_route`. Pass the application’s `id` and the path, opening with one `/`. `environment` is `production` where you give none, so give `development` to request the development copy. The platform builds the address from the environment's own hostname and takes no host from you. A redirect is followed only on the same hostname over https, at most five; any other redirect comes back as the result. The body comes back up to 64 KiB, or the lower `max_body_bytes` you pass, `truncated` true past it, and the call ends within 20 seconds. One account makes at most 60 requests a minute, shared with `write_route`. Each `routes` entry counts as one request. `routes` takes up to five requests in one call, one `test_end_user` sign-in serving them all. Each request may carry `expect`, the status it should return; a match counts as passed, including a deliberate 401 or 404.",
  "annotations": {
    "readOnlyHint": true,
    "destructiveHint": false,
    "openWorldHint": true,
    "idempotentHint": true
  }
}

MCP catalog entry #

{
  "name": "request_route",
  "title": "Request a route",
  "tier": "reversible",
  "scenario": "API-L0-26",
  "summary": "Request a deployed route with HTTP `GET` if your shell cannot reach it, using `write_route` for other methods.\n\nAn omitted `environment` defaults to production. With `test_end_user`, it is required. `test_end_user` supplies a temporary session. `session_as` `bearer` sends it as a bearer token. Without a session, a 401 on invited or workforce routes outside session-free paths may be the router's gate.\n\nA `GET` that changes data still has those effects. The production consent and retry rules for `write_route` apply.",
  "owners": [
    "API-L0-26",
    "MAPI-28",
    "SVC-L0-07",
    "SVC-L0-24",
    "EGW-L0-01",
    "PLD-L0-67",
    "PLD-L0-59",
    "ACS-L0-21"
  ]
}

request #

JSON pointer Description and constraints
"" (root) Type: object
Required fields: ["application"]
Retired members: body and routes[].body: request_route sends GET, which carries no body: call write_route to send a body with POST, PUT, PATCH, or DELETE.
/properties/application Your account's application id from list_applications, not its name or label.

Type: string
/properties/environment Target environment. Default production. Required with test_end_user. Requesting development before it is created is refused environment_not_created; an environment without a serving version is refused never_deployed.

Type: string
Allowed values: ["development","production"]
/properties/method Default GET. Other methods use write_route.

Type: string
Allowed values: ["GET"]
/properties/path One request uses path, a batch uses routes. Paths start with one / and may include a query. Leading //, spaces and control characters are refused invalid_request.

Type: string
Maximum length: 2048
/properties/headers No line breaks. Refused invalid_request: accept-encoding, host, content-length, hop headers, and x-forwarded-, x-azure-, x-fd-, x-envoy-, x-k8se-, x-ms-containerapp-, x-turnzero-cloud- except x-turnzero-cloud-client, or x-app-cloud-.

Type: object
maxProperties: 16
/properties/headers/additionalProperties Type: string
/properties/follow_redirects Default true. False returns a same-host redirect with its status and location.

Type: boolean
/properties/max_body_bytes Decoded response bytes returned. It only lowers the cap: 64 KiB for one request, 12 KiB per batch entry. Zero returns status and headers alone.

Type: integer
Minimum: 0
Maximum: 65536
/properties/routes Ordered batch. max_body_bytes and test_end_user stay at the top level; one sign-in serves the list. No top-level method, path, headers or follow_redirects. Each entry counts toward 60 shared requests per clock minute. Response body per entry: 12 KiB; list: 60 s.

Type: array
Minimum items: 1
Maximum items: 5
/properties/routes/items Type: object
Required fields: ["path"]
Additional properties: false
/properties/routes/items/properties/method Default GET. Other methods use write_route.

Type: string
Allowed values: ["GET"]
/properties/routes/items/properties/path Required path with one leading /, optionally followed by a query; at most 2,048 characters. Leading //, spaces and control characters are refused invalid_request.

Type: string
Maximum length: 2048
/properties/routes/items/properties/headers Headers for this request, under the top-level headers rules.

Type: object
maxProperties: 16
/properties/routes/items/properties/headers/additionalProperties Type: string
/properties/routes/items/properties/follow_redirects Default true. False returns a same-host redirect with its status and location.

Type: boolean
/properties/routes/items/properties/expect Expected status to check, such as 200, 401 or 404. A match does not count as failed, and the result carries expected.

Type: integer
Minimum: 100
Maximum: 599
/properties/test_end_user Test user's id or label for a temporary session, under sign_in_test_end_user's rules. Needs environment; omit cookie. Use session_as bearer for a bearer-only route.

Type: string
/properties/session_as How to send the test user's session: cookie by default, or bearer as Authorization: Bearer with no cookie. Needs test_end_user; with bearer, omit your own authorization header.

Type: string
Allowed values: ["cookie","bearer"]

response #

JSON pointer Description and constraints
"" (root) Type: object
Required fields: ["contract_version","application","environment"]
/anyOf/0 Required fields: ["method","url","status","headers","body","body_encoding","body_bytes","truncated","redirects","elapsed_ms"]
/anyOf/1 Required fields: ["results","failed"]
/properties/contract_version Required value: 1
/properties/reference The short reference the platform recorded your call under: ten lowercase hexadecimal characters, the value in the call’s record row. Quote it when you report the call.

Type: string
Pattern: ^[0-9a-f]{10}$
/properties/application The application id.

Type: string
/properties/environment The environment requested: production where the call gave none.

Type: string
Allowed values: ["development","production"]
/properties/method The call's own method, kept where a redirect was followed with GET.

Type: string
Allowed values: ["GET","POST","PUT","PATCH","DELETE"]
/properties/url The last address requested: the environment's hostname and the path, or the same-host address the last redirect followed gave.

Type: string
/properties/status The HTTP status of the last response, a redirect the call did not follow included.

Type: integer
/properties/headers The last response's headers, each name in lower case with one string value, repeated set-cookie values joined by a line break. With test_end_user, the session's value is replaced wherever it appears.

Type: object
/properties/headers/additionalProperties Type: string
/properties/body The response body, up to 64 KiB or max_body_bytes, counted after any decoding: the text where the bytes are UTF-8, else base64.

Type: string
/properties/body_encoding utf-8 where body is the text itself, base64 where the bytes are not UTF-8.

Type: string
Allowed values: ["utf-8","base64"]
/properties/body_bytes The size of body in bytes: of its UTF-8 text, or of the bytes the base64 carries.

Type: integer
Minimum: 0
/properties/truncated True where the body passed its bound, 64 KiB or max_body_bytes, counted after any decoding, so the connection was ended and body holds the bytes up to that bound, a cut last character left out of UTF-8 text.

Type: boolean
/properties/redirects How many same-host redirects the call followed, at most five.

Type: integer
Minimum: 0
Maximum: 5
/properties/elapsed_ms The call's time from its first address check to the end of the body's read, in milliseconds.

Type: integer
Minimum: 0
/properties/detail With status 400 or more and x-request-id, gives the held read_logs call by ID from the request start. A console read from that start uses container for servers or pool for functions. A static site has no function console. Filter by ID only if the code printed it.

Type: string
/properties/results With routes, in place of the members from method to detail: one result per request, in order. Each holds those members, its body cut at 12 KiB, or the lower max_body_bytes, with truncated true past it, or, for a request refused route_unreachable, method, url, and refused with the refusal's error, reason, and detail. A result of a request that gave expect also carries expected.

Type: array
/properties/results/items Type: object
/properties/results/items/properties/expected Present where the request gave expect: true where its status equals it, false where it differs or the request was refused route_unreachable.

Type: boolean
/properties/failed With routes: how many results were refused, returned a status other than their request's expect, or, for a request with no expect, returned a status of 400 or more.

Type: integer
Minimum: 0
/properties/note With routes, present only where failed counts a request with no expect that returned a status of 400 or more. It gives their count and says to set expect to the intended status to count a matching result as passed. Refused requests are excluded from this count.

Type: string

Complete payload contract #

{
  "request": {
    "type": "object",
    "required": [
      "application"
    ],
    "properties": {
      "application": {
        "type": "string",
        "description": "Your account's application `id` from `list_applications`, not its name or label."
      },
      "environment": {
        "type": "string",
        "enum": [
          "development",
          "production"
        ],
        "description": "Target environment. Default production. Required with `test_end_user`. Requesting `development` before it is created is refused `environment_not_created`; an environment without a serving version is refused `never_deployed`."
      },
      "method": {
        "type": "string",
        "enum": [
          "GET"
        ],
        "description": "Default `GET`. Other methods use `write_route`."
      },
      "path": {
        "type": "string",
        "maxLength": 2048,
        "description": "One request uses `path`, a batch uses `routes`. Paths start with one `/` and may include a query. Leading `//`, spaces and control characters are refused `invalid_request`."
      },
      "headers": {
        "type": "object",
        "additionalProperties": {
          "type": "string"
        },
        "maxProperties": 16,
        "description": "No line breaks. Refused `invalid_request`: `accept-encoding`, `host`, `content-length`, hop headers, and `x-forwarded-`, `x-azure-`, `x-fd-`, `x-envoy-`, `x-k8se-`, `x-ms-containerapp-`, `x-turnzero-cloud-` except `x-turnzero-cloud-client`, or `x-app-cloud-`."
      },
      "follow_redirects": {
        "type": "boolean",
        "description": "Default true. False returns a same-host redirect with its status and `location`."
      },
      "max_body_bytes": {
        "type": "integer",
        "minimum": 0,
        "maximum": 65536,
        "description": "Decoded response bytes returned. It only lowers the cap: 64 KiB for one request, 12 KiB per batch entry. Zero returns status and headers alone."
      },
      "routes": {
        "type": "array",
        "minItems": 1,
        "maxItems": 5,
        "items": {
          "type": "object",
          "properties": {
            "method": {
              "type": "string",
              "enum": [
                "GET"
              ],
              "description": "Default `GET`. Other methods use `write_route`."
            },
            "path": {
              "type": "string",
              "maxLength": 2048,
              "description": "Required path with one leading `/`, optionally followed by a query; at most 2,048 characters. Leading `//`, spaces and control characters are refused `invalid_request`."
            },
            "headers": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              },
              "maxProperties": 16,
              "description": "Headers for this request, under the top-level `headers` rules."
            },
            "follow_redirects": {
              "type": "boolean",
              "description": "Default true. False returns a same-host redirect with its status and `location`."
            },
            "expect": {
              "type": "integer",
              "minimum": 100,
              "maximum": 599,
              "description": "Expected status to check, such as `200`, `401` or `404`. A match does not count as `failed`, and the result carries `expected`."
            }
          },
          "required": [
            "path"
          ],
          "additionalProperties": false
        },
        "description": "Ordered batch. `max_body_bytes` and `test_end_user` stay at the top level; one sign-in serves the list. No top-level `method`, `path`, `headers` or `follow_redirects`. Each entry counts toward 60 shared requests per clock minute. Response body per entry: 12 KiB; list: 60 s."
      },
      "test_end_user": {
        "type": "string",
        "description": "Test user's id or label for a temporary session, under `sign_in_test_end_user`'s rules. Needs `environment`; omit `cookie`. Use `session_as` `bearer` for a bearer-only route."
      },
      "session_as": {
        "type": "string",
        "enum": [
          "cookie",
          "bearer"
        ],
        "description": "How to send the test user's session: `cookie` by default, or `bearer` as `Authorization: Bearer` with no cookie. Needs `test_end_user`; with `bearer`, omit your own `authorization` header."
      }
    },
    "x-retired": {
      "body": "`request_route` sends `GET`, which carries no body: call `write_route` to send a body with `POST`, `PUT`, `PATCH`, or `DELETE`.",
      "routes[].body": "`request_route` sends `GET`, which carries no body: call `write_route` to send a body with `POST`, `PUT`, `PATCH`, or `DELETE`."
    }
  },
  "response": {
    "type": "object",
    "required": [
      "contract_version",
      "application",
      "environment"
    ],
    "anyOf": [
      {
        "required": [
          "method",
          "url",
          "status",
          "headers",
          "body",
          "body_encoding",
          "body_bytes",
          "truncated",
          "redirects",
          "elapsed_ms"
        ]
      },
      {
        "required": [
          "results",
          "failed"
        ]
      }
    ],
    "properties": {
      "contract_version": {
        "const": 1
      },
      "reference": {
        "type": "string",
        "pattern": "^[0-9a-f]{10}$",
        "description": "The short reference the platform recorded your call under: ten lowercase hexadecimal characters, the value in the call’s record row. Quote it when you report the call."
      },
      "application": {
        "type": "string",
        "description": "The application id."
      },
      "environment": {
        "type": "string",
        "enum": [
          "development",
          "production"
        ],
        "description": "The environment requested: `production` where the call gave none."
      },
      "method": {
        "type": "string",
        "enum": [
          "GET",
          "POST",
          "PUT",
          "PATCH",
          "DELETE"
        ],
        "description": "The call's own method, kept where a redirect was followed with `GET`."
      },
      "url": {
        "type": "string",
        "description": "The last address requested: the environment's hostname and the path, or the same-host address the last redirect followed gave."
      },
      "status": {
        "type": "integer",
        "description": "The HTTP status of the last response, a redirect the call did not follow included."
      },
      "headers": {
        "type": "object",
        "additionalProperties": {
          "type": "string"
        },
        "description": "The last response's headers, each name in lower case with one string value, repeated `set-cookie` values joined by a line break. With `test_end_user`, the session's value is replaced wherever it appears."
      },
      "body": {
        "type": "string",
        "description": "The response body, up to 64 KiB or `max_body_bytes`, counted after any decoding: the text where the bytes are UTF-8, else base64."
      },
      "body_encoding": {
        "type": "string",
        "enum": [
          "utf-8",
          "base64"
        ],
        "description": "`utf-8` where `body` is the text itself, `base64` where the bytes are not UTF-8."
      },
      "body_bytes": {
        "type": "integer",
        "minimum": 0,
        "description": "The size of `body` in bytes: of its UTF-8 text, or of the bytes the base64 carries."
      },
      "truncated": {
        "type": "boolean",
        "description": "True where the body passed its bound, 64 KiB or `max_body_bytes`, counted after any decoding, so the connection was ended and `body` holds the bytes up to that bound, a cut last character left out of UTF-8 text."
      },
      "redirects": {
        "type": "integer",
        "minimum": 0,
        "maximum": 5,
        "description": "How many same-host redirects the call followed, at most five."
      },
      "elapsed_ms": {
        "type": "integer",
        "minimum": 0,
        "description": "The call's time from its first address check to the end of the body's read, in milliseconds."
      },
      "detail": {
        "type": "string",
        "description": "With status 400 or more and `x-request-id`, gives the held `read_logs` call by ID from the request start. A console read from that start uses `container` for servers or `pool` for functions. A static site has no function console. Filter by ID only if the code printed it."
      },
      "results": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "expected": {
              "type": "boolean",
              "description": "Present where the request gave `expect`: true where its status equals it, false where it differs or the request was refused `route_unreachable`."
            }
          }
        },
        "description": "With `routes`, in place of the members from `method` to `detail`: one result per request, in order. Each holds those members, its `body` cut at 12 KiB, or the lower `max_body_bytes`, with `truncated` true past it, or, for a request refused `route_unreachable`, `method`, `url`, and `refused` with the refusal's `error`, `reason`, and `detail`. A result of a request that gave `expect` also carries `expected`."
      },
      "failed": {
        "type": "integer",
        "minimum": 0,
        "description": "With `routes`: how many results were refused, returned a status other than their request's `expect`, or, for a request with no `expect`, returned a status of 400 or more."
      },
      "note": {
        "type": "string",
        "description": "With `routes`, present only where `failed` counts a request with no `expect` that returned a status of 400 or more. It gives their count and says to set `expect` to the intended status to count a matching result as passed. Refused requests are excluded from this count."
      }
    }
  }
}

Shared contracts #