arazzo: 1.0.1 info: title: Last.fm Now Playing Context summary: Read a user's most recent track, resolve its full info, and surface the community tags that describe it. description: >- A context flow that explains what a listener is playing right now. It reads the user's recent tracks, takes the most recent one, resolves its full info envelope, and then pulls the top community tags for that track so a UI can label the current play with its genres and moods. Each request is written inline, including the required api_key and the format=json selector, so the chain is self-contained and replayable without the OpenAPI source. version: 1.0.0 sourceDescriptions: - name: lastfmApi url: ../openapi/lastfm-openapi-original.yml type: openapi workflows: - workflowId: now-playing-context summary: Turn a user's latest scrobble into a track profile with descriptive top tags. description: >- Reads recent tracks, resolves the latest track's info, and pulls its top community tags. inputs: type: object required: - apiKey - user properties: apiKey: type: string description: Your Last.fm API key. user: type: string description: The Last.fm username whose recent listening to inspect. steps: - stepId: recentTracks description: >- Read the user's most recent scrobbles, including any currently playing track. operationId: userGetRecentTracks parameters: - name: api_key in: query value: $inputs.apiKey - name: format in: query value: json - name: user in: query value: $inputs.user - name: limit in: query value: 5 successCriteria: - condition: $statusCode == 200 outputs: latestTrackName: $response.body#/recenttracks/track/0/name latestTrackArtist: $response.body#/recenttracks/track/0/artist/name - stepId: trackInfo description: >- Resolve the full info envelope for the user's most recent track. operationId: trackGetInfo parameters: - name: api_key in: query value: $inputs.apiKey - name: format in: query value: json - name: artist in: query value: $steps.recentTracks.outputs.latestTrackArtist - name: track in: query value: $steps.recentTracks.outputs.latestTrackName - name: autocorrect in: query value: 1 successCriteria: - condition: $statusCode == 200 outputs: trackName: $response.body#/track/name trackArtist: $response.body#/track/artist/name trackUrl: $response.body#/track/url - stepId: trackTopTags description: >- Pull the top community tags that describe the current track. operationId: trackGetTopTags parameters: - name: api_key in: query value: $inputs.apiKey - name: format in: query value: json - name: artist in: query value: $steps.trackInfo.outputs.trackArtist - name: track in: query value: $steps.trackInfo.outputs.trackName - name: autocorrect in: query value: 1 successCriteria: - condition: $statusCode == 200 outputs: topTags: $response.body#/toptags/tag topTagName: $response.body#/toptags/tag/0/name outputs: user: $inputs.user trackName: $steps.trackInfo.outputs.trackName trackArtist: $steps.trackInfo.outputs.trackArtist trackUrl: $steps.trackInfo.outputs.trackUrl topTags: $steps.trackTopTags.outputs.topTags