Nodes/MTB Nodes/Any To String (mtb)
ComfyUI Node Runs on cloud

Any To String (mtb)

Convert any value to text in ComfyUI

By melMass·Created 3 years ago·Updated about a month ago· 721
Any To String (mtb)
  • input
  • STRING

Any To String (mtb) is a tiny adapter that takes literally any input and turns it into a string. Numbers, booleans, lists, whatever a node upstream produced - feed it in, get its text representation out. It's the kind of node you don't know you need until a wire refuses to connect because the types don't match.

Two everyday uses. First, debugging: you want to see a value flowing through your graph - a seed, a computed dimension, some flag - so you convert it to a string and pipe it into a text-display or a note. Second, plumbing: a node downstream only accepts a STRING (a filename builder, a text combiner, a caption field) and the thing you have is an int or a float. Any To String is the glue that lets them talk.

It's in the converters section of MTB Nodes (comfy_mtb) by melMass, which is full of exactly these little type-adapter nodes.

How it works

Its single input is typed as the wildcard *, which is ComfyUI's "accept anything" type - that's why it connects to any output regardless of what kind of value it is. Internally it just renders whatever it received as text (the equivalent of Python's str()), so a number becomes its digits, a boolean becomes True/False, a list becomes its bracketed form, and so on. No model, no computation to speak of - it's a format shim.

The inputs and outputs that matter

  • input (type *) - anything. The whole point of the node is that it doesn't care what you give it.

Output is a single STRING - the text version of whatever came in. Wire it into a text display for debugging, or into any node that wants a string.

That's the entire node. There are no settings to tune, which is exactly why it's reliable: one input, one output, no surprises.

How to install it

ComfyUI Manager: search MTB Nodes, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/melMass/comfy_mtb

then restart. Pure Python, nothing to download.

Common issues & troubleshooting

The string isn't "pretty." It converts to the value's default text form, not a formatted one. A tensor or a complex object turns into its raw representation, which can be long and ugly. For clean display of simple values (ints, floats, seeds) it's perfect; for big structured objects, expect a technical-looking dump rather than a tidy summary.

It "accepted" an image/tensor and gave gibberish. The * input really does take anything, including things that don't have a meaningful text form. Converting an IMAGE to a string gives you a tensor description, not the picture. Use it on scalar-ish values - numbers, flags, short lists - where a text form actually means something.

Type still won't connect downstream. Any To String guarantees a STRING out; it can't fix a node downstream that wants a different type. If the next node needs an int, you need an int-converter, not this one.

Categorymtb/converters

Inputs (1)

NameTypeDefaultDescription
input*

Outputs (1)

NameTypeDescription
STRINGSTRING