Dive

Built-in tools

builtin__reshape

Builds a value in a new JSON shape from earlier step results.

Behavior

  • shape is a JSON object whose leaf strings are templates.
  • A leaf that is exactly one template keeps the value's type; mixed text becomes a string.
  • It only moves data. It can't compute values like sums or conditionals.

When to use it

  • Rename, pick or nest fields between steps.
  • To reshape every item in a list, call it inside a map and reference {{item}}.
LoadedKindEffect
AlwaysreshapeRead-only

Input

shapeobject | any[] | stringrequired

The output shape. Usually an object: keys are literal and each leaf string is a template over the step's data (earlier results as {{Ex.field}}, the current map element as {{item}}, plan inputs as {{input.x}}), e.g. {"pr":"{{item.number}}","label":"issue-{{item.number}}"}. A single template string such as "{{item.sha}}" returns that one value, so a map over a list of objects can produce a plain list of keys.

Output

The shape with every template resolved, so its type is the shape's. A leaf that is exactly one template keeps its source's type, and a leaf with surrounding text renders to a string. A shape that is a single template string returns that one value.

- id: E1
  tool_name: builtin__reshape
  input:
    shape: "{{input.shape}}"