Repository navigation
Description
Summary
A FastMCPApp backend tool whose user-chosen name looks like a hashed backend name (<12 lowercase hex>_<name>, e.g. abcdef012345_save) is treated as already identity-addressed. When the app is composed with a namespaced mount() or a provider namespace, the emitted Prefab payload keeps the bare name instead of the listed namespaced name, so the UI callback fails:
listed: ['ns_abcdef012345_save', 'ns_form']
refs: ['abcdef012345_save']
failed: NotFoundError Unknown tool: 'abcdef012345_save'
The payload identity map even self-identifies: {"abcdef012345_save": "abcdef012345_save"}. The no-namespace provider variant fails the same way, while ordinary tool names work.
Reproduction (current main adf90b6, offline)
app = FastMCPApp("contacts")
@app.tool(name="abcdef012345_save")
def save(name: str) -> str: ... # ordinary backend tool, hash-shaped name
@app.ui
def contacts_form() -> ...: ... # references save via CallTool
server = FastMCP("host")
server.mount(app, namespace="ns")
# list tools -> ['ns_abcdef012345_save', ...]
# Prefab payload refs -> ['abcdef012345_save'] (should be ns_abcdef012345_save)
# call_tool('abcdef012345_save') -> NotFoundErrorRoot cause
fastmcp_slim/fastmcp/apps/app.py:77-85 (_prefix): any name matching parse_hashed_backend_name() is assumed pre-addressed without verifying that the digest is actually hash_tool(app_name, local_name). annotate_payload_identities then records a false self-identity, and rewrite_payload_tool_names (server/providers/prefab_payload.py:115-158) resolves get_tool_by_hash("abcdef012345", "save") to nothing and restores the stale bare name. After a mount/provider rename, that name is not callable.
Suggested fix
Treat a name as pre-addressed only when it equals hashed_backend_name(app_name, parsed_local_name); otherwise prefix it normally. Genuine pre-addressed names remain unchanged.
Tests
A fix with unit and integration tests is ready: the resolver maps a hash-shaped user name to the app address, a genuinely pre-addressed name stays unchanged, and a namespaced mount/provider emits the listed ref and executes the tool. I'll open the linked PR with red/green evidence.
Activity
marvin-context-protocol commentedon Oct 19, 2026
Thanks for the report. This issue goes beyond what our contributor guidelines ask for — we just need a short problem description and an MRE. Please see our contributing guidelines and condense this issue. We'll triage it once it's trimmed down.
Wilson0511 commentedon Oct 20, 2026
Reproduced on current
mainwith the issue's scenario, and verified the suggested direction: a name is treated as pre-addressed solely because it matchesparse_hashed_backend_name(), without checking the digest is actuallyhash_tool(app_name, local_name).Branch ready with the fix + tests (carried forward from the author-closed #5867):
_prefixnow passes a name through only when it equalshashed_backend_name(app_name, parsed_local_name); hash-shaped user names get a normal identity.test_hash_shaped_name_is_still_given_an_identity+ bothTestHashShapedToolNamescompose variants); 103 pass acrosstests/test_fastmcp_app.pyandtests/server/providers/test_prefab_roundtrip.pywith the fix.Happy to open the PR once assigned.
🤖 Prepared with ZCode (AI agent) on behalf of Wilson0511
Prefix backend hash addresses with double underscores (PrefectHQ#6100)