{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lastping-dev/json-schema/lastping-dev-ping-instructions-schema.json",
  "title": "PingInstructions",
  "description": "Everything needed to make a monitor actually report: the ping URL, copy-paste check-in snippets, and the three MECHANISMS for reporting, returned together. This is the exact payload the MCP `get_ping_instructions` tool returns — both surfaces are rendered from the same source, so they can never describe the reporting protocol differently.\n`reporting_options` explains how to choose between `how_to` (the universal manual protocol — works in any agent, any language, any tool, with no prerequisite), `hook_install` (an optional shortcut, Claude Code specific), and `run_wrapper` (wraps a launched command — cron, CI, a script — so a separate process reports for you). Read it before defaulting to the raw curl list.",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lastping-dev-openapi.yaml#/components/schemas/PingInstructions",
  "type": "object",
  "required": [
    "monitor_id",
    "monitor_name",
    "ping_url",
    "success_url",
    "start_url",
    "fail_url",
    "step_url",
    "curl_success",
    "curl_start",
    "curl_fail",
    "curl_step",
    "cron_example",
    "run_example",
    "step_timeout_s",
    "reporting_options",
    "run_wrapper",
    "hook_install",
    "how_to",
    "how_to_steps",
    "expectations_how_to",
    "failure_inbox_how_to",
    "discovery_how_to",
    "otel_traces_endpoint",
    "otel_resource_attributes",
    "otel_headers_hint",
    "otel_env_lines",
    "tracing_how_to"
  ],
  "properties": {
    "monitor_id": {
      "type": "string",
      "format": "uuid"
    },
    "monitor_name": {
      "type": "string"
    },
    "ping_url": {
      "type": "string",
      "description": "The success-ping URL — a bare POST (or GET/HEAD) reports success."
    },
    "success_url": {
      "type": "string",
      "description": "Identical to `ping_url`; present under both names for readability at each call site."
    },
    "start_url": {
      "type": "string",
      "description": "`{ping_url}/start` — send before long or possibly-hung runs, to enable overrun/never-finished detection."
    },
    "fail_url": {
      "type": "string",
      "description": "`{ping_url}/fail` — reports a failed run."
    },
    "step_url": {
      "type": "string",
      "description": "`{ping_url}/step?rid=<run-id>&step=<step-name>` — a liveness marker inside an already-started run. `<run-id>` and `<step-name>` are literal placeholders to fill in, not escaped example values."
    },
    "curl_success": {
      "type": "string"
    },
    "curl_start": {
      "type": "string"
    },
    "curl_fail": {
      "type": "string"
    },
    "curl_step": {
      "type": "string",
      "description": "A worked curl example carrying a literal `$RID` shell variable and a sample step label."
    },
    "cron_example": {
      "type": "string",
      "description": "A one-liner pairing a job with its success ping, for a crontab entry."
    },
    "run_example": {
      "type": "string",
      "description": "The whole armed run in the order it happens — start, steps, terminal ping — sharing one `$RID`, which the individual curl_* fields cannot show on their own."
    },
    "step_timeout_s": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64",
      "description": "The monitor's stall budget, echoed back so the caller can see whether the steps it is about to emit are actually watched. `null` means stall detection is off (the default)."
    },
    "reporting_options": {
      "type": "string",
      "description": "The decision rule for choosing between `how_to`, `hook_install` and `run_wrapper`, keyed on what the monitored thing IS."
    },
    "run_wrapper": {
      "type": "string",
      "description": "The `lastping run` command-wrapper snippet. Fits anything launched as a command; cannot send `blocked` or `note`."
    },
    "hook_install": {
      "type": "string",
      "description": "The one-time hook install, Claude Code's by default, or Codex's or Antigravity CLI's with `hook_tool`. Specific to that tool; installed once, it reports runs from the tool's own hooks."
    },
    "how_to": {
      "type": "string",
      "description": "The manual protocol prompt — the universal path, fitting any agent, any language, any tool."
    },
    "how_to_steps": {
      "type": "string",
      "description": "Explains step reporting (`curl_step`) and whether stall detection is armed on this monitor."
    },
    "expectations_how_to": {
      "type": "string",
      "description": "How to commit, at the START of a run, to the criteria that run will be judged by when it closes — before the outcome is knowable. Immutable once declared; declaring nothing is allowed and leaves the monitor's own assertions in force."
    },
    "failure_inbox_how_to": {
      "type": "string",
      "description": "The RETURN path: how to read what broke while this agent was not running (`GET /api/v1/agents/{id}/open-incidents`) and how to write the diagnosis back onto the incident a human reads (`POST /api/v1/incidents/{id}/notes`). Every other field here is about reporting outward; this is the only one that flows back."
    },
    "discovery_how_to": {
      "type": "string",
      "description": "How to find what ELSE ought to be monitored — crontab lines, GitHub Actions schedules, Kubernetes CronJobs, systemd timers — and reconcile the scan into monitors via `POST /api/v1/discovery/reconcile`. Scanning is entirely agent-side; LastPing never reads a repository or logs into a host. Carries the three rules that make the scan safe: propose what you found and get agreement before creating anything, READ the host's timezone rather than assume one for `crontab` and `systemd-timer` sources (they fire in local time), and the fact that reconcile never deletes, pauses or edits anything — which is what makes it safe to re-run as drift detection.\nProject-scoped rather than check-scoped, and served here on purpose: this is the endpoint an agent is already told to call right after creating a monitor, which is the moment the question \"what else here is unwatched?\" is both live and answerable."
    },
    "otel_traces_endpoint": {
      "type": "string",
      "description": "The OTLP/HTTP traces endpoint — the ping HOST alone (e.g. `https://ping.lastping.dev/v1/traces`), not this monitor's own `ping_url`: the Bearer-authenticated `/v1/traces` route takes its project from the API key, not a path segment. Standard OTel exporters need only this value and a header to start sending traces with no code change."
    },
    "otel_resource_attributes": {
      "type": "string",
      "description": "The literal `OTEL_RESOURCE_ATTRIBUTES` value: this monitor's id. A run id is optional (each trace becomes its own run without one), so none is baked in."
    },
    "otel_headers_hint": {
      "type": "string",
      "description": "The literal `OTEL_EXPORTER_OTLP_HEADERS` value, with a placeholder for a tracing key: an `ingest` key bound to this monitor (`POST /api/v1/checks/{id}/ingest-keys`), never the caller's own read, write or admin key. The monitor-URL form (`{ping_url}/v1/traces`) needs no header at all: the monitor id in the URL is itself the capability."
    },
    "otel_env_lines": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Ready-to-source shell `export` statements, one string per line: `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` (the signal-specific variable, so it carries the full `/v1/traces` path), `OTEL_EXPORTER_OTLP_PROTOCOL` (required: Python's distro otherwise picks a protocol LastPing does not accept), `OTEL_RESOURCE_ATTRIBUTES` and `OTEL_EXPORTER_OTLP_HEADERS`. Kept for compatibility; `GET /api/v1/checks/{id}/trace-setup` is the complete, per-tool form."
    },
    "tracing_how_to": {
      "type": "string",
      "description": "The tracing section of the protocol prompt: what an agent does, itself, to make its tool send OpenTelemetry to this monitor (pick its tool, fetch that tool's block from `GET /api/v1/checks/{id}/trace-setup` with `tool` set, write the files, keep the key out of committed code and never echo it, send a test span and report where it landed), and the content default (prompts and commands are not stored unless a person turns on \"Store prompts and commands\" for the monitor). It never contains a key. The per-tool blocks are not in this payload."
    }
  }
}