MediaWiki has gone and moved their "Main Page" to "MediaWiki". As a result of this, numerous API examples no longer work as originally intended. For example, clicking on the examples listed in the auto-documentation at https://www.mediawiki.org/wiki/API:Images , you will get an essentially empty result set, showing nothing of what the examples were intended to show.
Someone could theoretically use Title::getMainPage(), but I'm not sure the extra complexity would really be worth it. Note that most of the time you'd also be needing to pass the main page title into the corresponding i18n message.
I hadn't actually thought to check that, Reedy. Oops! That's odd, though. I could swear most of the examples used to work. Did they maybe point to en-wiki or something? Or am I just remembering the old manual documentation? <shrug>
You may have looked at them on enwiki or some other wiki where the main page is "Main Page". The old auto-generated documentation used the same examples as the current documentation does in almost all cases.
I just checked, and I'm thinking of the old manually documented examples (Template:ApiEx). They all pointed at enwiki. I finished the API portion of my project quite some time ago, so I haven't had much call to look at the live docs since then.
@srodlund this is a problem for the automatically generated documentation.
I don't know if there's a way to fix that in the documentation. I'm also not sure that @Anomie 's suggestion would actually help with that documentation.
I see ~41 references to "Main Page" in the API self-documentation. This is a pretty good first bug to fix.