When source_table === target_table (e.g. quest_template.PrevQuestId → quest_template.Id), bare column references in the user-supplied WHERE clause were ambiguous because both s and t aliases expose every column. MySQL returned Column 'X' in where clause is ambiguous.
Fix: auto-prefix bare column identifiers with s. when a self-join is detected. Already-qualified columns (s.Foo, t.Foo), SQL keywords, quoted string literals, and alias prefixes (the t in t.Title) are left untouched.
This makes the natural usage just work:
find_orphan_refs(
source_table='quest_template',
source_column='PrevQuestId',
target_table='quest_template',
target_column='Id',
where='PrevQuestId > 0' # auto-prefixed to s.`PrevQuestId`
)
If you need to reference a target-table column instead, qualify it explicitly with t.colname.
Upgrade
cd wow-server-mcp
git pull && npm install && npm run buildRestart your AI client.