Skip to main content
Glama

hub_heartbeat

Record agent liveness per work cycle to show in hub_presence without a human bridge and refresh this node's published snapshot for cross-node visibility.

Instructions

Record that an agent is alive — call it each work cycle (right after hub_report, before the next hub_queue_wait) so MCP/headless agents show up in hub_presence the same way screen-scraped ones do, no human bridge needed. Overwrites this agent's one presence record; freshness is judged at read time from ttlMin (default 15min), the same pattern hub_claim uses. Also refreshes this node's published snapshot (presence..json) at most once every 5 minutes, so agents on OTHER nodes can see you at all — the directory itself is node-local and never syncs.

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": {
      "agent": "<agent>"
    },
    "name": "hub_heartbeat"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdNoyour absolute working directory, optional
roleNothe queue role you work under, e.g. "hubd" — lets hub_brief pair queue depth with who is listening
turnNonumber of the current or last turn
agentYesyour stable identity, e.g. your agent name
stateNowhat the loop is doing, as a field a supervisor reads without parsing status: turn | waiting | exit. The hub keeps state_since — when this state began — across heartbeats that repeat it.
statusNofree text, e.g. "working" / "waiting" / "blocked"
ttlMinNominutes before this record counts as stale, default 15
task_idNothe task/id you are currently on, optional
empty_countNoconsecutive empty polls while waiting
exit_reasonNoone line, with state=exit
silent_countNoconsecutive restarts of a model that produced no output
turn_startedNowhen the current turn began, or "now"; carried while the turn number stays the same

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.9.88
    • addedInput schema / properties / empty_count
      Added value: +{
      +  "description": "consecutive empty polls while waiting",
      +  "type": "integer"
      +}
    • addedInput schema / properties / exit_reason
      Added value: +{
      +  "description": "one line, with state=exit",
      +  "type": "string"
      +}
    • addedInput schema / properties / silent_count
      Added value: +{
      +  "description": "consecutive restarts of a model that produced no output",
      +  "type": "integer"
      +}
    • addedInput schema / properties / state
      Added value: +{
      +  "description": "what the loop is doing, as a field a supervisor reads without parsing status: turn | waiting | exit. The hub keeps state_since — when this state began — across heartbeats that repeat it.",
      +  "type": "string"
      +}
    • addedInput schema / properties / turn
      Added value: +{
      +  "description": "number of the current or last turn",
      +  "type": "integer"
      +}
    • addedInput schema / properties / turn_started
      Added value: +{
      +  "description": "when the current turn began, or \"now\"; carried while the turn number stays the same",
      +  "type": "string"
      +}
  2. Addedv0.5.0

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does well: it discloses that the call overwrites the agent's single presence record, that staleness is computed at read time from ttlMin (default 15) rather than expiring the row, and that a node-level snapshot is republished at most once every 5 minutes — an explicit rate limit. What it omits is the cost/failure surface of a heartbeat call (what happens if it fails, whether there is a return payload).

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?

The imperative leads and every clause carries information (ordering, overwrite semantics, TTL model, snapshot cadence, node-local caveat). It is two very dense sentences with heavy parenthetical nesting, so it is efficient but harder to scan than it needs to be.

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

Completeness4/5

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

For a 12-parameter, no-annotation, no-output-schema tool, the description covers the behavioral essentials: overwrite semantics, staleness model, cross-node visibility, and call ordering. It leaves the return value and error behavior unstated, which is a minor but real gap for an agent integrating it into a loop.

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% for all 12 parameters, so the schema already documents every field including ttlMin's default and the state_since carry-over rule. The description only restates the ttlMin default, adding no new syntax, valid-value, or interaction detail beyond the structured fields; baseline 3 applies.

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 ("Record that an agent is alive") and immediately situates it in the loop relative to hub_report, hub_queue_wait, and hub_presence. An agent can tell this apart from hub_presence (the read side) and hub_claim without opening any 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 explicit call-site guidance: "each work cycle (right after hub_report, before the next hub_queue_wait)", plus who benefits (MCP/headless agents vs screen-scraped ones). The contrast with hub_presence as the consumer of this record makes the when-to-use condition unambiguous.

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