read_counters

Generated automatically from the published contract sources.

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.

A script calls this action over HTTPS at POST https://turnzero.ai/api/v1/actions/read_counters, with a bearer credential and the action's payload as the JSON body. It also accepts GET.

Contract description

Read a deployed application's counter totals for one environment — each counter by name, summed per hour or per day over a time window. The counters are the ones the application's own code writes through the Logging package, so a window it wrote none in answers no bucket; the platform's own usage, its backend actions and transferred bytes among them, is read with `read_usage`.

Access and action metadata

{
  "name": "read_counters",
  "resource": "environment",
  "tier": "observe",
  "summary": "The environment's counter totals by name over a window, at the hour or day grain (the logging service).",
  "annotations": {
    "readOnlyHint": true,
    "destructiveHint": false,
    "openWorldHint": false,
    "idempotentHint": true
  }
}

MCP catalog entry

{
  "name": "read_counters",
  "tier": "observe",
  "scenario": "CHI-L0-09",
  "summary": "Read a deployed application's counter totals for one environment — each counter by name, summed per hour or per day over a time window. The counters are the ones the application's own code writes through the Logging package, so a window it wrote none in answers no bucket; the platform's own usage, its backend actions and transferred bytes among them, is read with `read_usage`.",
  "owners": [
    "PLD-L0-40",
    "LGS-L0-15"
  ]
}

request

JSON pointer Description and constraints
"" (root) Type: object
Required fields: ["application","environment"]
/properties/application The application id, from `list_applications`.

Type: string
/properties/environment The stream to read: `development` or `production`, or `local` for the developer-machine stream.

Type: string
/properties/name One counter's name; omitted, every counter.

Type: string
/properties/grain `hour` or `day`; `day` where none is given.

Type: string
/properties/since Inclusive start of the time window. Use YYYY-MM-DD followed by T (or t), HH:mm, optional :ss, an optional decimal fraction of 1–9 digits after seconds, then Z (or z) or a signed HH:mm offset. The calendar date must exist; hours are 00–23, minutes and seconds 00–59, and offset hours/minutes 00–23/00–59. Leap seconds and 24:00 are not accepted. Values normalize to UTC at millisecond precision. Omission leaves this bound open; the HTTP action returns 400 invalid_request naming the member for null, empty strings, wrong types, or malformed values. MCP rejects wrong argument types before action dispatch.

Type: string
/properties/until Inclusive end of the time window. Use YYYY-MM-DD followed by T (or t), HH:mm, optional :ss, an optional decimal fraction of 1–9 digits after seconds, then Z (or z) or a signed HH:mm offset. The calendar date must exist; hours are 00–23, minutes and seconds 00–59, and offset hours/minutes 00–23/00–59. Leap seconds and 24:00 are not accepted. Values normalize to UTC at millisecond precision. Omission leaves this bound open; the HTTP action returns 400 invalid_request naming the member for null, empty strings, wrong types, or malformed values. MCP rejects wrong argument types before action dispatch.

Type: string
/properties/limit The most bucket rows answered, in bucket order; clamped to 1,000, the read ceiling, and the ceiling where omitted. A malformed value is ignored.

Type: integer
Minimum: 1

response

JSON pointer Description and constraints
"" (root) Type: object
Required fields: ["contract_version","environment","grain","buckets"]
/properties/contract_version Required value: 1
/properties/reference The short reference the platform recorded this call under, ten lowercase hexadecimal characters, the value the call’s record row carries; quote it when reporting the call.

Type: string
Pattern: ^[0-9a-f]{10}$
/properties/environment Type: string
/properties/grain Type: string
/properties/buckets Type: array
/properties/buckets/items Type: object
Required fields: ["name","bucket_start","total"]
/properties/buckets/items/properties/name Type: string
/properties/buckets/items/properties/bucket_start Type: string
/properties/buckets/items/properties/total Type: integer

Complete payload contract

{
  "request": {
    "type": "object",
    "required": [
      "application",
      "environment"
    ],
    "properties": {
      "application": {
        "type": "string",
        "description": "The application id, from `list_applications`."
      },
      "environment": {
        "type": "string",
        "description": "The stream to read: `development` or `production`, or `local` for the developer-machine stream."
      },
      "name": {
        "type": "string",
        "description": "One counter's name; omitted, every counter."
      },
      "grain": {
        "type": "string",
        "description": "`hour` or `day`; `day` where none is given."
      },
      "since": {
        "type": "string",
        "description": "Inclusive start of the time window. Use YYYY-MM-DD followed by T (or t), HH:mm, optional :ss, an optional decimal fraction of 1–9 digits after seconds, then Z (or z) or a signed HH:mm offset. The calendar date must exist; hours are 00–23, minutes and seconds 00–59, and offset hours/minutes 00–23/00–59. Leap seconds and 24:00 are not accepted. Values normalize to UTC at millisecond precision. Omission leaves this bound open; the HTTP action returns 400 invalid_request naming the member for null, empty strings, wrong types, or malformed values. MCP rejects wrong argument types before action dispatch."
      },
      "until": {
        "type": "string",
        "description": "Inclusive end of the time window. Use YYYY-MM-DD followed by T (or t), HH:mm, optional :ss, an optional decimal fraction of 1–9 digits after seconds, then Z (or z) or a signed HH:mm offset. The calendar date must exist; hours are 00–23, minutes and seconds 00–59, and offset hours/minutes 00–23/00–59. Leap seconds and 24:00 are not accepted. Values normalize to UTC at millisecond precision. Omission leaves this bound open; the HTTP action returns 400 invalid_request naming the member for null, empty strings, wrong types, or malformed values. MCP rejects wrong argument types before action dispatch."
      },
      "limit": {
        "type": "integer",
        "minimum": 1,
        "description": "The most bucket rows answered, in bucket order; clamped to 1,000, the read ceiling, and the ceiling where omitted. A malformed value is ignored."
      }
    }
  },
  "response": {
    "type": "object",
    "required": [
      "contract_version",
      "environment",
      "grain",
      "buckets"
    ],
    "properties": {
      "contract_version": {
        "const": 1
      },
      "reference": {
        "type": "string",
        "pattern": "^[0-9a-f]{10}$",
        "description": "The short reference the platform recorded this call under, ten lowercase hexadecimal characters, the value the call’s record row carries; quote it when reporting the call."
      },
      "environment": {
        "type": "string"
      },
      "grain": {
        "type": "string"
      },
      "buckets": {
        "type": "array",
        "items": {
          "type": "object",
          "required": [
            "name",
            "bucket_start",
            "total"
          ],
          "properties": {
            "name": {
              "type": "string"
            },
            "bucket_start": {
              "type": "string"
            },
            "total": {
              "type": "integer"
            }
          }
        }
      }
    }
  }
}

Shared contracts