Nodes/ComfyUI_mittimiTools/DaisyChainString
ComfyUI Node

DaisyChainString

Prefix, main text, suffix — a three-part string stitcher that chains its own output

By mittimi·Created 7 months ago·Updated 6 months ago· 0
DaisyChainString
    • text
    add_first
    text
    add_last

    DaisyChainString does one thing: add_first + text + add_last. It takes a prefix, a main body, and an optional suffix, and returns the three stitched together as a single string. The "daisy chain" part isn't marketing - because the output is itself a plain STRING, you can feed it into the text input of another DaisyChainString and keep adding prefixes and suffixes as far down the chain as you like.

    Why you'd reach for it

    Prompt building is the obvious home. You keep the actual prompt in one clean multiline box, and let DaisyChainString bolt on a consistent prefix (quality tags, style anchors, a trigger word) and a consistent suffix (negative modifiers, camera settings) without you retyping them into every prompt. Change the prefix once and every branch that feeds through it picks it up.

    It's also a decent way to wrap text - tuck a section in wildcard brackets, add a weighted (text:1.2), or glue a dynamic chunk (a filename, a random tag, an LLM-generated bit) into a fixed template. Because you can chain, a multi-part prompt that needs "prefix A + body + mid + body2 + suffix" just becomes two of these in a row instead of a purpose-built five-way concat node.

    How it works

    The implementation is pure string concatenation:

    def daisyChainStringMittimi(self, text, add_first="", add_last=""):
        return (add_first + text + add_last, )
    

    That's the entire mechanism. Nothing gets parsed, evaluated, or transformed - if your text has newlines in it, they stay in the output. There's no separator inserted for you; if you want a space or comma between the prefix and the body, you type it yourself. That's a feature, honestly - you get exactly what you wrote, no surprises.

    The inputs that matter

    • add_first - the prefix, single-line. Goes at the front.
    • text - the body. This one is multiline, so it's where your actual prompt lives.
    • add_last - the suffix, optional and single-line. Goes at the back. Leave it empty if you don't need it.

    The single output, text, is a STRING carrying the full concatenation. Wire it into a CLIP Text Encode (positive or negative prompt), another DaisyChainString, or any node that takes a string.

    One structural quirk: add_first is marked required even though an empty string works fine. It just means the widget has to exist - don't worry about it.

    Installing it

    This is part of mittimi/ComfyUI_mittimiTools, a five-node personal pack by mittimi. The README is two lines, so this article is roughly the documentation. Install via ComfyUI Manager (search ComfyUI_mittimiTools) or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/mittimi/ComfyUI_mittimiTools
    

    Restart ComfyUI. The only dependency is toml (already present in ComfyUI), and there are no model downloads.

    The honest caveats

    There isn't much to break with string concatenation. Worth knowing: the prefix and suffix fields are single-line, so multi-line blocks go in text; if you chain a few of these, the graph can get visually busy for what is a simple operation. And for heavyweight prompt engineering - token weighting, wildcard expansion, conditionals - you'll eventually outgrow this and reach for a real text-tools pack. But as a zero-config, readable way to keep your prompts tidy and consistent, it does the job without fuss.

    CategorymittimiTools

    Inputs (3)

    NameTypeDefaultDescription
    add_firstSTRING
    textSTRING
    add_lastoptSTRING

    Outputs (1)

    NameTypeDescription
    textSTRING