ToolkitsEntertainmentSpotify

Spotify

Description: Enable agents to interact with Spotify tracks.

Author: Arcade

Code: GitHub

Auth: User authorization via the Spotify auth provider

Note: This Toolkit is not available in Arcade Cloud. You can use these tools with a self-hosted instance of Arcade.

PyPI VersionLicensePython VersionsWheel StatusDownloads

The Arcade Spotify toolkit provides a pre-built set of tools for interacting with Spotify. These tools make it easy to build agents and AI apps that can:

  • Get information about tracks
  • Search for tracks
  • Control playback

Install

pip install arcade_spotify

Available Tools

Tool NameDescription
GetTrackFromIdGet information about a track
AdjustPlaybackPositionAdjust the playback position within the currently playing track. Note: This tool currently requires a self-hosted instance of Arcade.
SkipToPreviousTrackSkip to the previous track in the user's queue, if any. Note: This tool currently requires a self-hosted instance of Arcade.
SkipToNextTrackSkip to the next track in the user's queue, if any. Note: This tool currently requires a self-hosted instance of Arcade.
PausePlaybackPause the currently playing track, if any. Note: This tool currently requires a self-hosted instance of Arcade.
ResumePlaybackResume the currently playing track, if any. Note: This tool currently requires a self-hosted instance of Arcade.
StartTracksPlaybackByIdStart playback of a list of tracks (songs). Note: This tool currently requires a self-hosted instance of Arcade.
GetPlaybackStateGet information about the user's current playback state, including track or episode, and active device. Note: This tool currently requires a self-hosted instance of Arcade.
GetCurrentlyPlayingGet information about the user's currently playing track. Note: This tool currently requires a self-hosted instance of Arcade.
PlayArtistByNamePlays a song by an artist and queues four more songs by the same artist. Note: This tool currently requires a self-hosted instance of Arcade.
PlayTrackByNamePlays a song by name. Note: This tool currently requires a self-hosted instance of Arcade.
GetAvailableDevicesGet the available devices. Note: This tool currently requires a self-hosted instance of Arcade.
SearchSearch Spotify catalog information. Note: This tool currently requires a self-hosted instance of Arcade.

If you need to perform an action that’s not listed here, you can get in touch with us to request a new tool, or create your own tools with the Spotify auth provider.

GetTrackFromId


Get information about a track

Parameters

  • track_id (string, required) The Spotify ID of the track

AdjustPlaybackPosition


Adjust the playback position within the currently playing track.

Knowledge of the current playback state is NOT needed to use this tool as it handles clamping the position to valid start/end boundaries to prevent overshooting or negative values.

This tool allows you to seek to a specific position within the currently playing track. You can either provide an absolute position in milliseconds or a relative position from the current playback position in milliseconds.

Note: Either absolute_position_ms or relative_position_ms must be provided, but not both.

Parameters

  • absolute_position_ms (integer, optional) The absolute position in milliseconds to seek to

  • relative_position_ms (integer, optional) The relative position from the current playback position in milliseconds to seek to


SkipToPreviousTrack


Skip to the previous track in the user’s queue, if any


SkipToNextTrack


Skip to the next track in the user’s queue, if any


PausePlayback


Pause the currently playing track, if any


ResumePlayback


Resume the currently playing track, if any


StartTracksPlaybackById


Start playback of a list of tracks (songs)

Parameters

  • track_ids (array, required) A list of Spotify track (song) IDs to play. Order of execution is not guarenteed.

  • position_ms (integer, optional) The position in milliseconds to start the first track from


GetPlaybackState


Get information about the user’s current playback state, including track or episode, and active device. This tool does not perform any actions. Use other tools to control playback.


GetCurrentlyPlaying


Get information about the user’s currently playing track


PlayArtistByName


Plays a song by an artist and queues four more songs by the same artist

Parameters

  • name (string, required) The name of the artist to play

PlayTrackByName


Plays a song by name

Parameters

  • track_name (string, required) The name of the track to play

  • artist_name (string, optional) The name of the artist of the track

GetAvailableDevices


Get the available devices



Search Spotify catalog information

Explanation of the q parameter: You can narrow down your search using field filters. The available filters are album, artist, track, year, upc, tag:hipster, tag:new, isrc, and genre. Each field filter only applies to certain result types.

The artist and year filters can be used while searching albums, artists and tracks. You can filter on a single year or a range (e.g. 1955-1960). The album filter can be used while searching albums and tracks. The genre filter can be used while searching artists and tracks. The isrc and track filters can be used while searching tracks. The upc, tag:new and tag:hipster filters can only be used while searching albums. The tag:new filter will return albums released in the past two weeks and tag:hipster can be used to return only albums with the lowest 10% popularity.

Example: q=“remaster track:Doxy artist:Miles Davis”

Parameters

  • q (string, required) The search query

  • types (array, required) The types of results to return, Valid values are ‘album’, ‘artist’, ‘playlist’, ‘track’, ‘show’, ‘episode’, ‘audiobook’

  • limit (integer, optional) The maximum number of results to return. Defaults to 1.