Skip to main content
Glama

wait_for_job

Read-only

Block until a job is terminal, then return it. Free, bounded, no poll loop.

    Returns the chosen get_job result_view plus timed_out, waited_ms and polls; branch on
    `status` exactly as you would with get_job. timed_out:true is NOT a failure, it
    means the budget ran out: call again with the SAME job_id. Waiting neither cancels
    nor charges; the worker charges when it runs the job either way. It returns
    IMMEDIATELY with worker_alive:false + `warning` when no worker exists here.
    Errors: unauthorized, not_found (unknown or foreign job_id), rate_limited.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
job_idYesThe job to wait on, as returned by start_generate_job (or by a generate_hooks call that auto-jobbed on deadline_ms). Account-scoped: an id you do not own reads as not_found.
api_keyNoAPI key for this call. Omit to fall back to the Authorization: Bearer / X-API-Key request header (streamable-HTTP only), then the VHGENGINE_API_KEY env var (the stdio default). No key resolvable -> unauthorized.
result_viewNoUse compact for source evidence and costs with less response text. Full preserves every audit receipt. Views never rerun or recharge research.full
timeout_secondsNoHow long to block, 1-300 seconds. Keep it BELOW your own MCP client's request timeout, or the client gives up before this tool answers. Running out is not an error: you get timed_out:true plus the job's live state.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNoOn failure: the same typed error envelope a synchronous call returns. details.cancelled true means YOU cancelled it with cancel_job, not a fault.
pollsNoHow many get_job reads this call made on your behalf.
stageNoThe real engine stage reached (e.g. brief, draft, judge).
job_idNoThe job waited on.
resultNoOn success: the FULL generate (or batch) body, always full-verbosity. At standard/full, a judge-ranked smart hook may also carry {shape, phone_test, say_it}; a judge-ranked research hook carries receipts {persona, shape, phone_test, say_it, pattern_source}. pattern_source is null when no measured opener was attributed, otherwise its nested provenance is the authoritative actual platform, source surface, transcript method, language, route, media, and origin-time record. Minimal keeps persona and shape, plus phone_test only when it is the warning value 'fail'. result_view=compact projects V1 research to source evidence, citations, limitations, cost and an execution summary. Full is the compatible default; changing views never executes research again. Other job types retain their existing body.
statusNoqueued, running, succeeded (see `result`) or failed (see `error`). With timed_out:false this is always succeeded or failed unless worker_alive is false.
warningNoPresent only alongside worker_alive:false; says what to do instead.
timed_outNotrue when timeout_seconds elapsed before the job finished. NOT a failure: call wait_for_job again with the SAME job_id, or poll get_job.
waited_msNoHow long this call actually blocked.
elapsed_msNoMilliseconds since the job started running.
eta_secondsNoEstimated seconds still remaining.
progress_pctNo0-100 progress within the run.
worker_aliveNoPresent and FALSE only when the wait returned immediately because no job worker will ever run this job. Then read `warning`.
hook_instancesNoImmutable non-prose served-occurrence identities. Profile-bound queued/running work returns an empty list; a successful result returns one row per served hook.
poll_after_secondsNoHow long to wait before polling again; 0 once finished.
resolved_creator_profileNoExact immutable creator-profile binding used by this occurrence. Null/absent for inline or unprofiled generation.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / result_view
      Added value: +{
      +  "default": "full",
      +  "description": "Use compact for source evidence and costs with less response text. Full preserves every audit receipt. Views never rerun or recharge research.",
      +  "enum": [
      +    "full",
      +    "compact"
      +  ],
      +  "title": "Result View",
      +  "type": "string"
      +}
    • changedOutput schema / properties / result / description
      Previous value: -"On success: the FULL generate (or batch) body, always full-verbosity. At standard/full, a judge-ranked smart hook may also carry {shape, phone_test, say_it}; a judge-ranked research hook carries receipts {persona, shape, phone_test, say_it, pattern_source}. pattern_source is null when no measured opener was attributed, otherwise its nested provenance is the authoritative actual platform, source surface, transcript method, language, route, media, and origin-time record. Minimal keeps persona and shape, plus phone_test only when it is the warning value 'fail'."New value: +"On success: the FULL generate (or batch) body, always full-verbosity. At standard/full, a judge-ranked smart hook may also carry {shape, phone_test, say_it}; a judge-ranked research hook carries receipts {persona, shape, phone_test, say_it, pattern_source}. pattern_source is null when no measured opener was attributed, otherwise its nested provenance is the authoritative actual platform, source surface, transcript method, language, route, media, and origin-time record. Minimal keeps persona and shape, plus phone_test only when it is the warning value 'fail'. result_view=compact projects V1 research to source evidence, citations, limitations, cost and an execution summary. Full is the compatible default; changing views never executes research again. Other job types retain their existing body."
  2. Changed1 schema field changed
    • changedOutput schema / properties / result / description
      Previous value: -"On success: the FULL generate (or batch) body, always full-verbosity. At standard/full, a judge-ranked smart hook may also carry {shape, phone_test, say_it}; a judge-ranked research hook carries receipts {persona, shape, phone_test, say_it, pattern_source}. pattern_source is null when no measured opener was attributed, otherwise its nested provenance is the authoritative actual platform, language, route, media, and origin-time record. Minimal keeps persona and shape, plus phone_test only when it is the warning value 'fail'."New value: +"On success: the FULL generate (or batch) body, always full-verbosity. At standard/full, a judge-ranked smart hook may also carry {shape, phone_test, say_it}; a judge-ranked research hook carries receipts {persona, shape, phone_test, say_it, pattern_source}. pattern_source is null when no measured opener was attributed, otherwise its nested provenance is the authoritative actual platform, source surface, transcript method, language, route, media, and origin-time record. Minimal keeps persona and shape, plus phone_test only when it is the warning value 'fail'."
  3. Changed2 schema fields changed
    • addedOutput schema / properties / hook_instances
      Added value: +{
      +  "description": "Immutable non-prose served-occurrence identities. Profile-bound queued/running work returns an empty list; a successful result returns one row per served hook.",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "commission_id": {
      +        "pattern": "^com_[0-9a-f]{24}$",
      +        "type": "string"
      +      },
      +      "hook_id": {
      +        "pattern": "^hook_[0-9a-f]{8}$",
      +        "type": "string"
      +      },
      +      "hook_instance_id": {
      +        "pattern": "^hki_[0-9a-f]{24}$",
      +        "type": "string"
      +      },
      +      "item_index": {
      +        "minimum": 0,
      +        "type": "integer"
      +      },
      +      "served_rank": {
      +        "minimum": 1,
      +        "type": "integer"
      +      }
      +    },
      +    "required": [
      +      "hook_instance_id",
      +      "hook_id",
      +      "commission_id",
      +      "item_index",
      +      "served_rank"
      +    ],
      +    "type": "object"
      +  },
      +  "type": [
      +    "array",
      +    "null"
      +  ]
      +}
    • addedOutput schema / properties / resolved_creator_profile
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Exact immutable creator-profile binding used by this occurrence. Null/absent for inline or unprofiled generation.",
      +  "properties": {
      +    "commission_schema_version": {
      +      "const": 3,
      +      "type": "integer"
      +    },
      +    "profile_id": {
      +      "pattern": "^cpr_[0-9a-f]{24}$",
      +      "type": "string"
      +    },
      +    "profile_snapshot_schema_version": {
      +      "minimum": 1,
      +      "type": "integer"
      +    },
      +    "version": {
      +      "minimum": 1,
      +      "type": "integer"
      +    }
      +  },
      +  "required": [
      +    "profile_id",
      +    "version",
      +    "profile_snapshot_schema_version",
      +    "commission_schema_version"
      +  ],
      +  "type": [
      +    "object",
      +    "null"
      +  ]
      +}
  4. Changed1 schema field changed
    • changedOutput schema / properties / result / description
      Previous value: -"On success: the FULL generate (or batch) body, always full-verbosity."New value: +"On success: the FULL generate (or batch) body, always full-verbosity. At standard/full, a judge-ranked smart hook may also carry {shape, phone_test, say_it}; a judge-ranked research hook carries receipts {persona, shape, phone_test, say_it, pattern_source}. pattern_source is null when no measured opener was attributed, otherwise its nested provenance is the authoritative actual platform, language, route, media, and origin-time record. Minimal keeps persona and shape, plus phone_test only when it is the warning value 'fail'."
  5. Added

TDQS

A4.6/5.0
Behavior5/5

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

Beyond readOnlyHint, the description discloses a lot of non-obvious behavior: waiting neither cancels nor charges and the worker charges regardless, timed_out is not a failure, immediate return with worker_alive:false plus warning when no worker exists, and the error set (unauthorized, not_found, rate_limited). That is exactly the kind of behavioral context annotations cannot carry.

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 lead sentence is front-loaded and the follow-on notes are each load-bearing (timeout semantics, billing, no-worker case, errors). The multi-line indentation and dense packing of four separate facts into one block slightly hurt scanability, but there is no filler.

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 bounded blocking call with an output schema, the description still explains the return shape in agent-relevant terms (timed_out, waited_ms, polls, worker_alive, warning) and the recovery action for each. Nothing an agent needs to call it correctly is missing.

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

Parameters4/5

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

Schema description coverage is 100%, so the baseline is 3, but the description adds cross-parameter meaning: timeout_seconds exhaustion produces timed_out:true (documented as 'budget'), and result_view is tied to the get_job views the caller already knows. This adds value on top of the already-complete schema.

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?

The first sentence gives a specific verb (block/wait) and resource (job) plus the terminal-state condition, which immediately separates it from get_job (non-blocking read) and list_jobs. An agent can tell what it does and which sibling it is not without opening schemas.

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

Usage Guidelines4/5

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

It explicitly frames the tool as an alternative to a poll loop ('Free, bounded, no poll loop') and tells the agent how to react to timed_out:true (call again with the SAME job_id) versus branching on status 'exactly as you would with get_job'. It stops short of an explicit when-not-to-use rule (e.g., prefer get_job for fire-and-forget checks), so it is clear context rather than full when/when-not/alternatives guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources