KosmoKrator

other

Spotify CLI for AI Agents

Use the Spotify CLI from KosmoKrator to call Spotify tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

8 functions 7 read 1 write Manual OAuth token auth

Spotify CLI Setup

Spotify can be configured headlessly with `kosmokrator integrations:configure spotify`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure spotify --set access_token="$SPOTIFY_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor spotify --json
kosmokrator integrations:status --json

Credentials

Authentication type: Manual OAuth token oauth2_manual_token. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
access_token SPOTIFY_ACCESS_TOKEN Secret secret yes Access Token
url SPOTIFY_URL URL url no API URL

Call Spotify Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call spotify.spotify_search '{
  "q": "example_q",
  "type": "example_type",
  "limit": 1,
  "offset": 1
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:spotify spotify_search '{
  "q": "example_q",
  "type": "example_type",
  "limit": 1,
  "offset": 1
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs spotify --json
kosmo integrations:docs spotify.spotify_search --json
kosmo integrations:schema spotify.spotify_search --json
kosmo integrations:search "Spotify" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Spotify.

spotify.spotify_get_track

Read read

Get detailed information about a specific Spotify track, including artists, album, duration, and popularity.

Parameters
id

Generic CLI call

kosmo integrations:call spotify.spotify_get_track '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:spotify spotify_get_track '{"id":"example_id"}' --json

spotify.spotify_get_artist

Read read

Get detailed information about a specific Spotify artist, including followers, genres, and popularity.

Parameters
id

Generic CLI call

kosmo integrations:call spotify.spotify_get_artist '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:spotify spotify_get_artist '{"id":"example_id"}' --json

spotify.spotify_list_playlists

Read read

List the current user's Spotify playlists. Returns playlist names, IDs, and track counts.

Parameters
limit, offset

Generic CLI call

kosmo integrations:call spotify.spotify_list_playlists '{"limit":1,"offset":1}' --json

Provider shortcut

kosmo integrations:spotify spotify_list_playlists '{"limit":1,"offset":1}' --json

spotify.spotify_get_playlist

Read read

Get detailed information about a Spotify playlist, including its tracks with artist and album details.

Parameters
id, limit, offset

Generic CLI call

kosmo integrations:call spotify.spotify_get_playlist '{"id":"example_id","limit":1,"offset":1}' --json

Provider shortcut

kosmo integrations:spotify spotify_get_playlist '{"id":"example_id","limit":1,"offset":1}' --json

spotify.spotify_create_playlist

Write write

Create a new Spotify playlist for the current user. Use the "Get Current User" tool first if you need the user ID.

Parameters
user_id, name, description, public

Generic CLI call

kosmo integrations:call spotify.spotify_create_playlist '{"user_id":"example_user_id","name":"example_name","description":"example_description","public":true}' --json

Provider shortcut

kosmo integrations:spotify spotify_create_playlist '{"user_id":"example_user_id","name":"example_name","description":"example_description","public":true}' --json

spotify.spotify_list_albums

Read read

List albums by a specific Spotify artist. Includes singles and compilations by default.

Parameters
id, include_groups, limit, offset

Generic CLI call

kosmo integrations:call spotify.spotify_list_albums '{"id":"example_id","include_groups":"example_include_groups","limit":1,"offset":1}' --json

Provider shortcut

kosmo integrations:spotify spotify_list_albums '{"id":"example_id","include_groups":"example_include_groups","limit":1,"offset":1}' --json

spotify.spotify_get_current_user

Read read

Get the authenticated user's Spotify profile, including their user ID (needed for creating playlists), display name, and follower count.

Parameters
none

Generic CLI call

kosmo integrations:call spotify.spotify_get_current_user '{}' --json

Provider shortcut

kosmo integrations:spotify spotify_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

spotify.spotify_get_track

Get detailed information about a specific Spotify track, including artists, album, duration, and popularity.

Operation
Read read
Schema command
kosmo integrations:schema spotify.spotify_get_track --json
ParameterTypeRequiredDescription
id string yes The Spotify track ID (e.g., "4cOdK2wGLETKBW3PvgPWqT").

spotify.spotify_get_artist

Get detailed information about a specific Spotify artist, including followers, genres, and popularity.

Operation
Read read
Schema command
kosmo integrations:schema spotify.spotify_get_artist --json
ParameterTypeRequiredDescription
id string yes The Spotify artist ID (e.g., "1dfeR4HaWDbWqFHLkxsg1d").

spotify.spotify_list_playlists

List the current user's Spotify playlists. Returns playlist names, IDs, and track counts.

Operation
Read read
Schema command
kosmo integrations:schema spotify.spotify_list_playlists --json
ParameterTypeRequiredDescription
limit integer no Maximum number of playlists to return (default 20, max 50).
offset integer no The index of the first playlist (default 0, use for pagination).

spotify.spotify_get_playlist

Get detailed information about a Spotify playlist, including its tracks with artist and album details.

Operation
Read read
Schema command
kosmo integrations:schema spotify.spotify_get_playlist --json
ParameterTypeRequiredDescription
id string yes The Spotify playlist ID.
limit integer no Maximum number of tracks to return (default 20, max 100).
offset integer no The index of the first track (default 0, use for pagination).

spotify.spotify_create_playlist

Create a new Spotify playlist for the current user. Use the "Get Current User" tool first if you need the user ID.

Operation
Write write
Schema command
kosmo integrations:schema spotify.spotify_create_playlist --json
ParameterTypeRequiredDescription
user_id string yes The Spotify user ID. Get this from the "Get Current User" tool.
name string yes The name for the new playlist.
description string no An optional description for the playlist.
public boolean no Whether the playlist should be public (default true).

spotify.spotify_list_albums

List albums by a specific Spotify artist. Includes singles and compilations by default.

Operation
Read read
Schema command
kosmo integrations:schema spotify.spotify_list_albums --json
ParameterTypeRequiredDescription
id string yes The Spotify artist ID.
include_groups string no Album types to include, comma-separated: "album", "single", "appears_on", "compilation". Defaults to "album,single".
limit integer no Maximum number of albums to return (default 20, max 50).
offset integer no The index of the first album (default 0, use for pagination).

spotify.spotify_get_current_user

Get the authenticated user's Spotify profile, including their user ID (needed for creating playlists), display name, and follower count.

Operation
Read read
Schema command
kosmo integrations:schema spotify.spotify_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.