Simplify get_display_name logic.
Closed
EG
2mo ago+10+10+01234567890123456789-11-11-01234567890123456789
Problem
get_display_name duplicated title-first precedence across Tool and non-Tool branches (title > name vs title > annotations.title > name). Only Tool.annotations.title needs a special middle branch.
Solution
Hoist the shared title check before the Tool branch. Keep the Tool.annotations.title fallback as the only type-specific branch. Fall through to name. No behavioral change.
Impact
Less branching, single title precedence path, easier to maintain. No API change.
Evidence
python -m py_compile src/mcp/shared/metadata_utils.py-> okruff check src/mcp/shared/metadata_utils.py-> All checks passed- Manual assertions for Tool/Resource/Prompt title/annotation/name precedence verified (title > annotations.title > name).
Fixes #3480