Skip to content

Expressions & Formatting

You don’t always need to build a custom tool to manipulate data. The Bridge provides built-in syntax for formatting strings, executing math, and branching logic inline.


String interpolation allows you to seamlessly construct URLs, headers, or text fields using {...} placeholders.

Interpolation only works on the right-hand side of a Pull Wire (<-). The engine scans the string, resolves each placeholder at runtime, and concatenates the final result.

bridge Query.userOrders {
with ordersApi as api
with input as i
with output as o
# Build a REST URL dynamically
api.path <- "/users/{i.id}/orders"
# Assemble display text
o.greeting <- "Hello, {i.firstName} {i.lastName}!"
}

Be careful not to use the Constant Wire (=) operator if you want variables to resolve! Constant wires ignore placeholders completely.

o.path = "/users/{i.id}" # Literal string: "/users/{i.id}"
o.path <- "/users/{i.id}" # Templated string: "/users/123"

Non-string values are automatically coerced into strings. null and undefined are safely converted into empty strings ("") to prevent "Hello, null" bugs.

If you need to include a literal curly brace in your string, escape it with a backslash: \{.

You can perform arithmetic and comparison operations directly inside your wire assignments.

o.cents <- i.dollars * 100
o.total <- i.price * i.quantity
o.eligible <- i.age >= 18
o.isActive <- i.status == "active"
CategoryOperatorsDescription
Arithmetic*, /, +, -Standard math operations.
Comparison==, !=, >, >=, <, <=Returns boolean true or false.
Booleanand, or, notLogical operators for combining boolean values.

Use Python/SQL-style keywords for clear, unambiguous boolean expressions. These strictly evaluate to true or false.

  • and: Logical AND — returns true only if both sides are truthy.
  • or: Logical OR — returns true if either side is truthy.
  • not: Logical NOT — inverts the value (prefix operator).
  • (): Parentheses for grouping — overrides default operator precedence.

Lazy Evaluation: Boolean operators (and and or) use strict left-to-right short-circuiting. If the left side of an and evaluates to false, the right side is completely ignored. If the right side is an expensive API call, it is never executed.

# Inline policy evaluation with parentheses for grouping
o.isApproved <- (i.age > 18 and i.verified) or i.role == "ADMIN"
o.requireMFA <- not (i.isTrusted)
# Override precedence: add before multiply
o.total <- (i.price + i.discount) * i.qty

Standard operator precedence applies: multiplication/division bind tightest, then addition/subtraction, then comparisons, then and, and finally or binds loosest. Use parentheses () to override the default precedence when needed.

# Evaluates as: i.base + (i.tax * 2)
o.total <- i.base + i.tax * 2
# Use parentheses to force addition first: (i.base + i.tax) * 2
o.total <- (i.base + i.tax) * 2
# Evaluates as: (i.price * i.qty) > 100
o.isExpensive <- i.price * i.qty > 100
# Without parens: (age > 18 and verified) or (role == "ADMIN")
o.allowed <- i.age > 18 and i.verified or i.role == "ADMIN"
# With parens: age > 18 and (verified or role == "ADMIN")
o.strict <- i.age > 18 and (i.verified or i.role == "ADMIN")

The conditional wire (ternary operator) allows you to select between two different sources based on a boolean condition.

# target <- condition ? true_branch : false_branch
o.amount <- i.isPro ? i.proPrice : i.basicPrice

The condition can be a direct boolean reference (i.isPro), or a full inline expression (i.age >= 18). The branches can be tool references, input variables, or literal values ("premium", true, 20).

o.tier <- i.score > 100 ? "premium" : "basic"

Just like and/or logic, conditional wires are strictly evaluated. The engine evaluates the condition first. It then pulls data from only the chosen branch.

If the condition is false, the engine never touches the true branch. If that branch points to an expensive API call, the API is never called.

# If i.hasCustomData is false, the customDb API is completely ignored.
o.data <- i.hasCustomData ? customDb.data : standardDb.data