Fetch a Last.fm user's recent listening history and top artists over configurable time periods
domain: last.fm · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Obtain a Last.fm API key (session/auth is not required for these public read methods, just an api_key)
Call `user.getRecentTracks` with `user`, `api_key`, and `format=json`, using `limit` (max 200 per page) and `page` to paginate, and `from`/`to` Unix timestamps to bound the range
Detect the currently-playing track by checking for the `nowplaying="true"` attribute on the first item, and treat it separately from completed scrobbles
Call `user.getTopArtists` with `user`, `api_key`, and a `period` value (overall, 7day, 1month, 3month, 6month, or 12month) to get ranked artists for that window
Use `limit` and `page` on getTopArtists as well when a user's history is large enough to need pagination
Cache responses appropriately, since repeatedly polling a user's recent tracks at high frequency against the public API can hit rate limits
Known gotchas
getRecentTracks' `from`/`to` range filtering has known edge cases with tracks scrobbled exactly at boundary timestamps — treat boundaries as inclusive/exclusive carefully and de-duplicate if paginating across a live-updating history
period-based top-artist queries are precomputed buckets (7day/1month/etc.), not arbitrary custom date ranges — you cannot pass an arbitrary from/to to getTopArtists the way you can to getRecentTracks
These are read-only public methods keyed only by username and api_key; they do not require the user to have authorized your app, so treat any Last.fm username's data as effectively public when using them
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?