Skip to main content
Glama

ap_add_step

ap_add_step

Add a new step to a flow. Optionally configure it in the same call by providing input/auth/sourceCode. Prefer PIECE actions and inline formula expressions over CODE.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
authNoConnection externalId from ap_list_connections. Pass the plain id, not a template.
inputNoFor PIECE/CODE steps: input config (key-value pairs). Reference a prior step's output with {{stepName['output'].field}} (output is nested under ['output'], e.g. {{trigger['output'].body.email}}, {{send_email['output'].id}}). For a continue-on-failure step's error, use {{stepName['error'].message}}.
flowIdYesThe id of the flow
stepTypeYesThe type of step to add. Prefer PIECE over CODE — only use CODE when no piece fits and the logic can't be done with an inline formula expression (in a free-text/value input) or a router condition.
loopItemsNoFor LOOP steps: expression for items to iterate (e.g. "{{step_1['output'].items}}").
pieceNameNoFor PIECE steps: the piece name (e.g. "@activepieces/piece-gmail"). Use ap_research_pieces to get valid values.
actionNameNoFor PIECE steps: the action name within the piece. Use ap_research_pieces with includeActions=true to get valid values.
sourceCodeNoFor CODE steps: JavaScript/TypeScript source. Must export a `code` function.
branchIndexNoBranch index (required when stepLocationRelativeToParent is INSIDE_BRANCH)
displayNameYesDisplay name for the step
packageJsonNoFor CODE steps: package.json as JSON string. Defaults to "{}".
parentStepNameYesThe step name to insert after/into (e.g. "trigger", "step_1"). Use ap_flow_structure to get valid values.
retryOnFailureNoFor CODE/PIECE steps: whether to retry this step on failure. Defaults to false.
continueOnFailureNoFor CODE/PIECE steps: set true on the step that can fail (the one whose failure you want to react to), NOT on the recovery step. Defaults to false. When true the flow keeps running on failure and the step gains On success / On failure branches — add handler steps into them with stepLocationRelativeToParent INSIDE_ON_SUCCESS_BRANCH / INSIDE_ON_FAILURE_BRANCH and parentStepName = this step.
stepLocationRelativeToParentYesWhere to place the step: AFTER = after the parent, INSIDE_LOOP = first action inside a loop, INSIDE_BRANCH = first action inside a router branch, INSIDE_ON_SUCCESS_BRANCH / INSIDE_ON_FAILURE_BRANCH = first action inside the On success / On failure branch of a continue-on-failure step (set continueOnFailure on the parent first).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / auth / description
      Previous value: -"Connection externalId from ap_list_connections. Auto-wrapped as {{connections['externalId']}}."New value: +"Connection externalId from ap_list_connections. Pass the plain id, not a template."
  2. First observed

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false, destructiveHint=false and idempotentHint=false, so the mutation profile is covered by structured data. The description adds that configuration can be folded into the same call, but says nothing about side effects on the flow, whether the flow must be published afterward, or the result of the call. Adequate but not rich.

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?

Two sentences, zero filler, with the core action stated first and the usage preference second. Nothing is repeated from the schema or annotations.

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 15-parameter, nested-object, no-output-schema mutation tool, the description is short but the schema carries nearly all the necessary detail (required fields, enums, placement semantics, helper tools). What is missing is post-call behavior: whether the flow is auto-saved/published and what the tool returns.

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 per-parameter text is unusually thorough (cross-references to ap_research_pieces, ap_flow_structure, ap_list_connections, expression syntax, continueOnFailure semantics), so the baseline is 3. The description only adds that input/auth/sourceCode are the optional inline-configuration trio, which is marginal value over the schema.

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

Purpose4/5

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

The first sentence gives a precise verb+resource ('Add a new step to a flow') and the second clarifies scope by noting the step can be configured inline in the same call. It is clearly separable from ap_update_step/ap_delete_step/ap_add_branch by name and verb, but the description never explicitly contrasts itself with those siblings.

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

Usage Guidelines3/5

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

The description offers a real preference rule ('Prefer PIECE actions and inline formula expressions over CODE'), but that guides stepType selection rather than tool selection. There is no statement of when to use ap_add_step versus ap_update_step, ap_build_flow, or ap_insert via other means, and no prerequisites (e.g., publishing, parent step existence) are given.

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