Skip to main content
Glama

CONDITION_SWITCH

Branches workflow execution by evaluating a condition expression and routing to true or false node paths, ending the path when a branch is missing.

Instructions

按条件表达式走 true / false 分支。运算符 ==、!=、>、<、>=、<=、contains、startswith、endswith;== / != 按字符串比较,> < >= <= 按数字比较(非数字当 0),contains/startswith/endswith 不区分大小写。左边是变量名(不要写 ${}),右边是字面值,值不加引号;> 和 < 两侧必须有空格;未定义变量按字符串 null 比较。分支写在节点的 branches(true/false → 节点 id),不走 next,缺的分支即该路径结束。。字符串参数支持 ${var} 插值;结果以变量快照 JSON 返回。

Input Schema

NameRequiredDescriptionDefault
requireNo执行后要求为 true 的变量名(如 click_success),不满足按出错处理
on_errorNo节点出错时:skip=跳过继续(默认),stop=停止整个工作流
expressionYes条件:变量名 运算符 值(如 battery_level > 20),或单个布尔变量名
node_timeout_msNo单节点超时毫秒,0=不限;默认 30 分钟

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior3/5

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

No annotations are supplied, so the description must carry the full behavioral burden, and it does disclose substantial runtime semantics: == / != compare as strings, > < >= <= coerce non-numeric values to 0, contains/startswith/endswith are case-insensitive, and undefined variables compare as the string 'null'. It still omits how missing variables or malformed expressions surface at runtime and does not describe the variable snapshot payload beyond naming its shape.

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 opening clause states the purpose first, then operator semantics, then branch wiring, then return shape – a sensible front-loaded order. It is dense with semicolon-chained clauses and ends with a doubled full stop, but nearly every clause carries real information.

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 four-parameter branching node with no output schema, the description covers the essential grammar, branch wiring, evaluation coercions, and the return format (a variable snapshot JSON). The main remaining gap is disambiguation from CONDITION_ADVANCED_SWITCH and any statement about expression-evaluation failure modes.

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 earns above baseline by specifying expression grammar the schema only gestures at: the operator set, that the left side is a bare variable name without ${}, that the right side is an unquoted literal, and that > and < require surrounding spaces. Interpolation of ${var} in string parameters is also noted. The require and on_error parameters are not elaborated beyond their schema text.

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?

States a specific verb and resource: routing a workflow along true/false branches by condition expression. An agent immediately understands the node type. It does not, however, distinguish itself from the sibling CONDITION_ADVANCED_SWITCH, leaving the reader to guess which branching node to pick.

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?

Operational context is clear: branches go in the node's branches map (true/false → node id), the node does not use next, and a missing branch simply ends that path. What is absent is explicit routing guidance against the alternative CONDITION_ADVANCED_SWITCH when a simple expression will not do.

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