Skip to main content
Glama

Create a heartbeat monitor

create_heartbeat

Register a scheduled job heartbeat so Fettle alerts you when cron jobs, backups, or workers stop reporting success pings within the configured period and grace time.

Instructions

Create a heartbeat: Fettle alerts when a scheduled job stops calling its ping_url. Use it for cron jobs, backups and workers that should report in; to probe a URL, host or port from outside use create_monitor. The job calls ping_url (GET or POST) on success, ping_url + "/start" when it begins (restarts the clock) and ping_url + "/fail" to go DOWN at once. It is never late before its first success ping (a /fail call still marks it DOWN); after that an alert fires period_seconds + grace_seconds after the last ping. Requires a key with the write scope. The plan caps how many heartbeats exist (403 past it; see get_plan_usage). An invalid argument is a 422 naming it. Returns the heartbeat, with ping_url. Example: {"name": "nightly backup", "period_seconds": 86400, "grace_seconds": 3600}

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "name": "<name>",
      "period_seconds": "<period_seconds>",
      "grace_seconds": "<grace_seconds>"
    },
    "name": "create_heartbeat"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesDisplay name, 1 to 255 characters.
tagsNoFlat labels for grouping and filtering, for example env:prod or service:api, at most 10. Each tag is trimmed, lowercased and deduplicated on write, at most 50 characters of a-z, 0-9 and : _ . / -, starting with a letter or digit. Reuse names from list_tags rather than inventing near-duplicates.
channel_idsNoNotification channel uuids from list_channels; email addresses are channels too. Omit it or pass [] to alert every working channel of the organization. A list replaces that default: only the listed channels are alerted, nobody else is emailed implicitly. An id that is not an active channel of this organization is a 404. Once every bound channel is deleted, every working channel is alerted. If none of the channels works, the organization's owner is emailed.
grace_secondsYesExtra seconds of silence tolerated after the period before the heartbeat is reported late, 0 to 2592000; it may exceed the period.
period_secondsYesHow often the job runs, 60 to 2592000 seconds. To ping every N seconds and be alerted after T seconds of silence, set period_seconds = N and grace_seconds = T - N (T at least N).

Output Schema

NameRequiredDescriptionDefault
idYes
nameYes
tagsNo
stateYesKnown values: PENDING, UP, DOWN, PAUSED.
ping_urlYes
is_activeYes
created_atYes
overdue_atYes
updated_atYes
channel_idsNoBound notification channels. Empty means every working channel of the organization is alerted.
last_ping_atYes
grace_secondsYes
last_start_atYes
period_secondsYes
last_success_atYes
last_duration_msYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv1.6.0
    • changedInput schema / properties / channel_ids / description
      Previous value: -"Notification channel uuids from list_channels. Omit it or pass [] to alert every verified, active channel of the organization. Email is not a channel: every alert also emails the creator. An id that is not an active channel of this organization is a 404."New value: +"Notification channel uuids from list_channels; email addresses are channels too. Omit it or pass [] to alert every working channel of the organization. A list replaces that default: only the listed channels are alerted, nobody else is emailed implicitly. An id that is not an active channel of this organization is a 404. Once every bound channel is deleted, every working channel is alerted. If none of the channels works, the organization's owner is emailed."
    • removedInput schema / properties / notification_cooldown_seconds
      Removed value: -{
      -  "description": "60 to 86400 seconds; 1800 when not set on create. Only holds back a duplicate first alert for the same incident within that window. Repeat reminders while an incident stays open and unacknowledged follow the plan's renotify_interval_seconds and renotify_max_count (get_plan_usage; 0 means no reminders) instead, and the recovery alert is never held back.",
      -  "maximum": 86400,
      -  "minimum": 60,
      -  "type": "integer"
      -}
    • addedOutput schema / properties / channel_ids / description
      Added value: +"Bound notification channels. Empty means every working channel of the organization is alerted."
    • removedOutput schema / properties / notification_cooldown_seconds
      Removed value: -{
      -  "type": "integer"
      -}
    • changedOutput schema / required
      Previous value: -[
      -  "id",
      -  "name",
      -  "state",
      -  "period_seconds",
      -  "grace_seconds",
      -  "ping_url",
      -  "last_ping_at",
      -  "last_success_at",
      -  "last_start_at",
      -  "last_duration_ms",
      -  "overdue_at",
      -  "notification_cooldown_seconds",
      -  "is_active",
      -  "created_at",
      -  "updated_at"
      -]New value: +[
      +  "id",
      +  "name",
      +  "state",
      +  "period_seconds",
      +  "grace_seconds",
      +  "ping_url",
      +  "last_ping_at",
      +  "last_success_at",
      +  "last_start_at",
      +  "last_duration_ms",
      +  "overdue_at",
      +  "is_active",
      +  "created_at",
      +  "updated_at"
      +]
  2. Changed1 schema field changedv1.3.0
    • changedInput schema / properties / channel_ids / description
      Previous value: -"Notification channel uuids from list_channels. Omit it or pass [] to alert every verified, active channel of the organization. An id that is not an active channel of this organization is a 404."New value: +"Notification channel uuids from list_channels. Omit it or pass [] to alert every verified, active channel of the organization. Email is not a channel: every alert also emails the creator. An id that is not an active channel of this organization is a 404."
  3. Changed7 schema fields changedv0.6.1
    • addedInput schema / properties / channel_ids / description
      Added value: +"Notification channel uuids from list_channels. Omit it or pass [] to alert every verified, active channel of the organization. An id that is not an active channel of this organization is a 404."
    • addedInput schema / properties / grace_seconds / description
      Added value: +"Extra seconds of silence tolerated after the period before the heartbeat is reported late, 0 to 2592000; it may exceed the period."
    • addedInput schema / properties / name / description
      Added value: +"Display name, 1 to 255 characters."
    • addedInput schema / properties / notification_cooldown_seconds / description
      Added value: +"60 to 86400 seconds; 1800 when not set on create. Only holds back a duplicate first alert for the same incident within that window. Repeat reminders while an incident stays open and unacknowledged follow the plan's renotify_interval_seconds and renotify_max_count (get_plan_usage; 0 means no reminders) instead, and the recovery alert is never held back."
    • addedInput schema / properties / period_seconds / description
      Added value: +"How often the job runs, 60 to 2592000 seconds. To ping every N seconds and be alerted after T seconds of silence, set period_seconds = N and grace_seconds = T - N (T at least N)."
    • addedInput schema / properties / tags / description
      Added value: +"Flat labels for grouping and filtering, for example env:prod or service:api, at most 10. Each tag is trimmed, lowercased and deduplicated on write, at most 50 characters of a-z, 0-9 and : _ . / -, starting with a letter or digit. Reuse names from list_tags rather than inventing near-duplicates."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "channel_ids": {
      +      "items": {
      +        "format": "uuid",
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "created_at": {
      +      "type": "string"
      +    },
      +    "grace_seconds": {
      +      "type": "integer"
      +    },
      +    "id": {
      +      "format": "uuid",
      +      "type": "string"
      +    },
      +    "is_active": {
      +      "type": "boolean"
      +    },
      +    "last_duration_ms": {
      +      "anyOf": [
      +        {
      +          "type": "integer"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "last_ping_at": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "last_start_at": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "last_success_at": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "name": {
      +      "type": "string"
      +    },
      +    "notification_cooldown_seconds": {
      +      "type": "integer"
      +    },
      +    "overdue_at": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "period_seconds": {
      +      "type": "integer"
      +    },
      +    "ping_url": {
      +      "type": "string"
      +    },
      +    "state": {
      +      "description": "Known values: PENDING, UP, DOWN, PAUSED.",
      +      "type": "string"
      +    },
      +    "tags": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "updated_at": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "id",
      +    "name",
      +    "state",
      +    "period_seconds",
      +    "grace_seconds",
      +    "ping_url",
      +    "last_ping_at",
      +    "last_success_at",
      +    "last_start_at",
      +    "last_duration_ms",
      +    "overdue_at",
      +    "notification_cooldown_seconds",
      +    "is_active",
      +    "created_at",
      +    "updated_at"
      +  ],
      +  "type": "object"
      +}
  4. First observedv0.5.4

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare the non-read-only, non-idempotent profile, but the description goes well beyond them: it explains the ping protocol (base URL, /start resets the clock, /fail goes DOWN immediately), the exact late-alert timing (period_seconds + grace_seconds after the last ping), the never-late-before-first-success rule, the required write scope, and the plan-cap 403. That is the kind of state-machine context annotations cannot express.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single front-loaded block that opens with what it creates before descending into ping semantics and error codes; nearly every sentence carries operational information. It is dense and long, but nothing is obviously redundant, and the trailing example is functional.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a creation tool with five parameters and a rich schema, the description covers the behavioral model, auth requirement, quota failure mode, and validation error; an output schema exists, so return values need not be restated. Nothing an agent needs to call this correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% and the schema already spells out the period/grace relationship, tag normalization, and channel fallback rules, so baseline 3 applies. The description adds only the combined alert timing formula and a sample argument object, which is marginal value over the structured fields.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ("Create a heartbeat") and immediately defines the resource's semantics: Fettle alerts when a scheduled job stops calling its ping_url. It explicitly separates itself from create_monitor by naming the external-probe case, so an agent can pick between the two without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete positive cases (cron jobs, backups, workers that should report in) and an explicit exclusion routing to create_monitor for probing a URL, host or port. Prerequisites and failure conditions (write scope, plan cap with 403, 422 on invalid arguments) are stated rather than inferred.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.