Skip to main content
Glama

Create a chat flow

create_flow

Create a chat flow. It is ALWAYS created inactive (isEnabled false): it answers no one until someone turns it on with set_flow_active, so write it, read it back with get_flow, and let the user decide. There is no isEnabled input. A flow with no keywords and no connectionIds on a MESSAGE_RECEIVED trigger would answer every message on every account once on — build the trigger narrow. Writing also needs chat enabled for the organization and an ADMIN or OWNER role in it, and a new flow counts against the plan's flow limit (403 CHAT_FLOW_LIMIT_REACHED) — the same refusals a person gets in the app. Needs the organization's "Let AI assistants create and edit chat flows" setting (mcpFlowsEnabled; only the organization's OWNER can switch it on, in Settings → Organization → General → AI Assistants; without it the api answers 403 MCP_FLOWS_DISABLED) and a connection authorized with the flows permissions — one authorized before they existed must remove PostRite from the assistant and add it again.

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>",
      "triggerType": "<triggerType>",
      "triggerConfig": "<triggerConfig>",
      "graph": "<graph>"
    },
    "name": "create_flow"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesThe flow's name, shown in the app (1 to 200 characters)
graphYesThe flow's graph: { entryNodeId, nodes (1 to 100 nodes), edges }, validated by the same schema the app's flow builder saves with. Every node has a unique `id` (letters, digits, - and _) and a `type`; `position` {x, y} is optional (the builder lays out a graph that has none). Node types and their fields (? = optional): SEND_MESSAGE {text (≤1000), attachments?: [{type: image|video|audio|file, url (≤2048), name? (≤255), mimeType? (≤120), size?, mediaId?, external?}], links?: [{id (≤40), label (≤20), url (≤2000)}]}; WAIT {seconds (integer ≤82800)}; WAIT_FOR_REPLY {quickReplies?: [{id (≤40), label (≤20)}], timeoutSeconds? (integer ≤604800)}; CONDITION {kind: HAS_TAG|ATTRIBUTE_EQUALS|CHANNEL_IS|WITHIN_BUSINESS_HOURS, key? (≤80), value? (≤200)}; ADD_TAG|REMOVE_TAG {tag (≤60)}; SET_ATTRIBUTE {key (≤80), value (≤500)}; REPLY_TO_COMMENT {texts[]}; ASK_INPUT {inputKind: email|phone|text, attributeKey (≤80), timeoutSeconds? (integer ≤604800)}; HANDOFF {note? (≤280)}; END. An edge is { from, to, fromHandle? }; `fromHandle` picks the branch: "next" (or omitted) on most nodes, "true"/"false" out of a CONDITION (it needs both), a quick reply's id or "timeout" out of WAIT_FOR_REPLY, "invalid" or "timeout" out of ASK_INPUT. A question is the SEND_MESSAGE that leads into a WAIT_FOR_REPLY: the reply buttons (quickReplies) are offered with that message, and each button becomes a branch. A circular menu is allowed; a run stops after 50 steps. On update_flow, a graph replaces the whole stored graph — send every node and edge, not a patch.
triggerTypeYesWhat starts the flow: MESSAGE_RECEIVED | FIRST_MESSAGE | COMMENT_RECEIVED | STORY_REPLY | STORY_MENTION | REFERRAL | MANUAL | ENTRY_POINT. The flow is inactive until set_flow_active turns it on.
connectionIdsNoThe connected messaging accounts (platform connection IDs, from list_platform_connections) this flow answers on. Empty or omitted means EVERY messaging account in the organization — say so to the user before turning the flow on.
triggerConfigYesWhat starts the flow, read per triggerType. Fields (? = optional): matchMode?: CONTAINS|EXACT|STARTS_WITH|ANY, keywords?[], platformPostIds?[], postId?, ref? (≤120). matchMode and keywords narrow a MESSAGE_RECEIVED trigger (no keywords = every message); platformPostIds narrows COMMENT_RECEIVED to those posts (absent = every post on the account, organic ones included); ref is the REFERRAL value of the ig.me / m.me link. Send {} for a trigger that needs no narrowing — the matchMode default applies.
organizationIdNoOrganization to act in — an id from list_organizations. Required when this connection was authorized for more than one organization; omit it when there is only one.
cooldownMinutesNoMinutes before the same contact can start this flow again (0 to 10080); omitted keeps the api default.
maxRunsPerContactPerDayNoHow many times one contact can start this flow in a day (1 to 20); omitted keeps the api default.

Output Schema

NameRequiredDescriptionDefault
idNo
nameNo
graphNo
runCountNo
createdAtNo
isEnabledNotrue = live: it answers real contacts
updatedAtNo
triggerTypeNo
connectionIdsNoThe accounts it answers on; empty = every messaging account
isGraphBrokenNoThe stored graph no longer parses; rewrite it with update_flow
triggerConfigNo
cooldownMinutesNo
lastTriggeredAtNo
runCountLast7DaysNo
maxRunsPerContactPerDayNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the annotations (readOnlyHint=false, destructiveHint=false, openWorldHint=true) by disclosing that creation never activates the flow, that there is no isEnabled input, the 403 CHAT_FLOW_LIMIT_REACHED refusal, the mcpFlowEnabled organization setting gated to OWNER, the ADMIN/OWNER role and chat-enabled prerequisites, and the re-authorization gotcha for old connections.

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?

Front-loaded with the most consequential fact (inactive by default) and kept dense. A few clauses are ornamental — "the same refusals a person gets in the app" and the very specific PostRite re-authorization anecdote — but nothing is confusing or padded enough to hurt.

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 an 8-parameter mutation tool with nested graph objects and an output schema, the description covers side effects, permissions, quotas, and activation flow. An agent has everything needed to call it safely without guessing.

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 coverage is 100%, so the baseline is 3, but the description adds real meaning: it explains that isEnabled is absent by design, warns that an empty keywords/connectionIds on MESSAGE_RECEIVED is broadcast-wide once enabled, and reinforces the default-all-accounts semantics of connectionIds.

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?

Opens with a specific verb+resource ("Create a chat flow") and immediately scopes the result ("ALWAYS created inactive"). It distinguishes itself from update_flow by noting the graph-replacement behavior there, and from set_flow_active by naming that tool as the activation step.

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 an explicit workflow: create, read back with get_flow, let the user decide, then set_flow_active. It also states when-not concerns (narrow the trigger, write it before turning on) and names the exact sibling tools involved.

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