Skip to main content
Glama

Wait For Workflow

wait_for_workflow
Destructive

Block until a similarity or propensity segment workflow completes, fails, or hits a HITL gate. Call this after create_segment(subtype=similarity/propensity) returns a workflow_run_id. Polls GET /v1/workflows/{id} every 30 seconds. Returns completed status with segment_id/audience_id when done. If hitl=true and a gate is hit, returns the gate payload so you can call respond_to_workflow_gate then wait_for_workflow again. Returns an actionable failure code and message if the workflow fails, or WORKFLOW_TIMEOUT after timeout_seconds (default 30 seconds). A wait timeout does not cancel or fail the workflow. Requires 'discovery' scope.

Input Schema

NameRequiredDescriptionDefault
timeout_secondsNoMaximum seconds to wait (default 30). Prefer get_workflow_status for a single status check; processing continues after a wait timeout.
workflow_run_idYesThe workflow run ID returned by create_segment(subtype=similarity/propensity)

Output Schema

NameRequiredDescriptionDefault
statusYes
failureNoSafe failure reason and next action when status is failed
guidanceNoInterpretation or recovery guidance for this result
count_unitNo
page_countNoNumber of objects on this page, not the organization total
segment_idNo
step_countYes
audience_idNo
count_stateNoUnknown means no count; available does not guarantee freshness. Recount for a current value.
paused_gateNo
current_stepYes
next_actionsNoSuggested next calls using returned IDs and available scopes. Not executed and not user consent.
money_displayNoCurrency amounts formatted once from source paths ending in _cents. Use verbatim; do not divide again. Null/missing source amounts are omitted, not zero.
workflow_run_idYes
population_inputNoPopulation input used for the preview; IDs refer to their current saved definitions

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / timeout_seconds / default
      Previous value: -7200New value: +30
    • changedInput schema / properties / timeout_seconds / description
      Previous value: -"Maximum seconds to wait (default 7200 = 2hr; BQML training routinely takes 10–60 min and a brief network blip near completion could cause a 1hr timeout to fire prematurely)"New value: +"Maximum seconds to wait (default 30). Prefer get_workflow_status for a single status check; processing continues after a wait timeout."
    • changedInput schema / properties / timeout_seconds / minimum
      Previous value: -60New value: +1
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": {},
      +  "properties": {
      +    "audience_id": {
      +      "type": "string"
      +    },
      +    "count_state": {
      +      "description": "Unknown means no count; available does not guarantee freshness. Recount for a current value.",
      +      "enum": [
      +        "unknown",
      +        "available"
      +      ],
      +      "type": "string"
      +    },
      +    "count_unit": {
      +      "const": "records",
      +      "type": "string"
      +    },
      +    "current_step": {
      +      "type": "number"
      +    },
      +    "failure": {
      +      "additionalProperties": false,
      +      "description": "Safe failure reason and next action when status is failed",
      +      "properties": {
      +        "code": {
      +          "type": "string"
      +        },
      +        "message": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "code",
      +        "message"
      +      ],
      +      "type": "object"
      +    },
      +    "guidance": {
      +      "description": "Interpretation or recovery guidance for this result",
      +      "type": "string"
      +    },
      +    "money_display": {
      +      "additionalProperties": {
      +        "type": "string"
      +      },
      +      "description": "Currency amounts formatted once from source paths ending in _cents. Use verbatim; do not divide again. Null/missing source amounts are omitted, not zero.",
      +      "propertyNames": {
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "next_actions": {
      +      "description": "Suggested next calls using returned IDs and available scopes. Not executed and not user consent.",
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "arguments": {
      +            "additionalProperties": {},
      +            "propertyNames": {
      +              "type": "string"
      +            },
      +            "type": "object"
      +          },
      +          "reason": {
      +            "type": "string"
      +          },
      +          "tool": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "tool",
      +          "arguments",
      +          "reason"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "page_count": {
      +      "description": "Number of objects on this page, not the organization total",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "paused_gate": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "gate_id": {
      +          "type": "string"
      +        },
      +        "message": {
      +          "type": "string"
      +        },
      +        "options": {
      +          "items": {
      +            "type": "string"
      +          },
      +          "type": "array"
      +        }
      +      },
      +      "required": [
      +        "gate_id",
      +        "message",
      +        "options"
      +      ],
      +      "type": "object"
      +    },
      +    "population_input": {
      +      "additionalProperties": {},
      +      "description": "Population input used for the preview; IDs refer to their current saved definitions",
      +      "propertyNames": {
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "segment_id": {
      +      "type": "string"
      +    },
      +    "status": {
      +      "type": "string"
      +    },
      +    "step_count": {
      +      "type": "number"
      +    },
      +    "workflow_run_id": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "workflow_run_id",
      +    "status",
      +    "current_step",
      +    "step_count"
      +  ],
      +  "type": "object"
      +}
  2. First observed

TDQS

A3.6/5.0
Behavior1/5

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

The description says this polls GET /v1/workflows/{id} and that a wait timeout does not cancel or fail the workflow, indicating a non-destructive read-only wait. The annotations declare destructiveHint=true and readOnlyHint=false, which directly conflicts with that behavior.

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

Conciseness5/5

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

The description is front-loaded with the core blocking behavior and then adds only operationally relevant details about polling, HITL handling, failure returns, timeout semantics, and required scope. Every sentence carries useful information for invoking the tool correctly.

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 complex asynchronous/HITL workflow tool, the description covers when to call it, polling behavior, timeout outcomes, HITL gate continuation, failure returns, and required scope. The main remaining gaps are the undefined hitl reference and the contradictory destructive annotation, though the output schema reduces the need to explain return values in prose.

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 coverage is 100%, so the baseline is 3. The description adds some value by linking workflow_run_id to create_segment and explaining WORKFLOW_TIMEOUT behavior, but it also references hitl=true even though no hitl parameter exists in this tool's schema, creating ambiguity.

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 description states a specific verb/resource and scope: it blocks until a similarity or propensity segment workflow completes, fails, or hits a HITL gate. It also distinguishes its role from a one-off status check by describing the blocking/polling behavior and the create_segment follow-up.

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 clearly says to call this after create_segment returns a workflow_run_id and explains the HITL loop with respond_to_workflow_gate followed by another wait. It does not explicitly contrast the tool with get_workflow_status or wait_for_segment in the description, though the timeout parameter schema mentions get_workflow_status.

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