Pattern

Variable hygiene for tool results

Whole tool-result objects stored in variables, which leak metadata JSON to end users and inflate conversation state until hard limits hit.

Last reviewed 8 July 2026

The pattern

Never pass a whole tool-result object onward. Store only the property you need, for example toolResult.responseText, in a topic variable. Point message nodes at that text variable, never at the full object. Later topics inherit what you stored, and a full object drags its metadata JSON along. This keeps internal JSON away from users and keeps the conversation state small.

When to use it

  • Every time a tool, connector, or flow returns an object and you store the result.
  • When users see raw JSON such as {"explanation_of_tool_call": …} after publishing.
  • When you hit "Conversation state size exceeds the maximum allowed limit".
  • When a channel rejects messages as too big, such as the 256 KB Direct Line cap.

Steps

  1. After the tool or connector action, add a "Set variable value" node.
  2. Store only the readable property, for example toolResult.responseText, in a topic variable.
  3. Point the message node at that text variable, not at the tool object.
  4. Repeat this in every topic that touches tool results; later topics inherit stored objects.
  5. Keep large data out of variables; store and fetch it through an agent flow instead.
  6. Pass single properties between topics, never whole objects or card payloads.