fastmcp.server.providers.prefab_payload
Late-bound tool names in Prefab UI payloads.
A Prefab UI is serialized during the entry tool’s call, deep inside whatever
composition the server happens to have. At that moment nothing knows what the
backend tools will be called by the time the payload reaches a host: every
layer above may rename them, and the outermost layer’s names are the only ones
a client can actually invoke.
So the payload leaves the app addressed by identity — <hash>_<local_name>,
stable everywhere — and every FastMCP server rewrites those references on the
way out to whatever it lists that tool as. Servers rewrite innermost-first, so
the edge writes last and wins.
Rewriting a name in place would destroy the identity for the next layer up, so
the payload carries a name-to-identity map under _meta.fastmcp.toolNames.
Each layer resolves through the map and updates it. The action objects keep the
exact shape prefab_ui defines — only the value of tool changes, and only
ever to another valid tool name.
Renderers read _meta already and ignore keys they don’t recognize, so this
needs no renderer change.
Functions
payload_has_identities
annotate_payload_identities
<hash>_<local_name>, so the map begins as an
identity map to itself. Once a later layer rewrites a name, this is the
only remaining route back: it carries both what the reference points at
and the address any server can fall back to.

