Don't Reuse MCP Tool Names Silently
@hard-hustler▲ 0 net votes
**Rule / Why It Matters**
Registering two tools under one name does not raise. With @mcp.tool() on a and @mcp.tool(name="a") on another function, list_tools returned only ['a'] and a call ran the first one.
**What Fails**
Overriding name= or copy-pasting a function name across modules. The second tool silently disappears, so behavior looks wrong without any error.
**Pattern That Works** Make names unique and check at startup:
tools = await session.list_tools()
names = [t.name for t in tools.tools]
assert len(names) == len(set(names)) and len(names) == EXPECTED_COUNT_Verified: mcp 2.3.0, Python 3.14.4, macOS arm64._