Skip to main content
Glama

get_current_track

Retrieve the currently playing track from Spotify to identify what's playing, share song details, or integrate with other music management tasks.

Instructions

Get the currently playing track

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for the 'get_current_track' tool that calls Spotify's /me/player/currently-playing API endpoint, checks if a track is playing, and returns formatted track information including name, artists, album, progress/duration, playing status, and track ID
    case "get_current_track": {
      const data = await spotifyRequest("/me/player/currently-playing");
    
      if (!data || !data.item) {
        return {
          content: [{ type: "text", text: "⏸️ No track currently playing" }],
        };
      }
    
      const track = data.item;
      const artists = track.artists.map((a: any) => a.name).join(", ");
      const progress = Math.floor(data.progress_ms / 1000);
      const duration = Math.floor(track.duration_ms / 1000);
    
      return {
        content: [
          {
            type: "text",
            text: `🎡 Currently Playing:\n\n` +
              `🎀 ${track.name}\n` +
              `πŸ‘€ ${artists}\n` +
              `πŸ’Ώ ${track.album.name}\n` +
              `⏱️ ${Math.floor(progress / 60)}:${(progress % 60).toString().padStart(2, "0")} / ${Math.floor(duration / 60)}:${(duration % 60).toString().padStart(2, "0")}\n` +
              `πŸ”Š ${data.is_playing ? "Playing" : "Paused"}\n` +
              `πŸ†” ID: ${track.id}`,
          },
        ],
      };
    }
  • src/index.ts:116-123 (registration)
    Tool registration defining 'get_current_track' with name, description ('Get the currently playing track'), and empty inputSchema indicating no parameters required
    {
      name: "get_current_track",
      description: "Get the currently playing track",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • Input schema for 'get_current_track' tool - an empty object type with no properties, indicating this tool requires no input parameters
    inputSchema: {
      type: "object",
      properties: {},
    },
  • Helper function 'spotifyRequest' that handles authenticated requests to Spotify API, including automatic token refresh via getAccessToken() and proper error handling
    async function spotifyRequest(endpoint: string, method = "GET", data?: any) {
      const token = await getAccessToken();
      
      try {
        const response = await axios({
          method,
          url: `https://api.spotify.com/v1${endpoint}`,
          headers: {
            Authorization: `Bearer ${token}`,
            "Content-Type": "application/json",
          },
          data,
        });
        return response.data;
      } catch (error: any) {
        if (error.response) {
          throw new Error(`Spotify API Error: ${error.response.data.error?.message || error.response.statusText}`);
        }
        throw new Error(`Network Error: ${error.message}`);
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states what the tool does but lacks behavioral details such as error conditions (e.g., if nothing is playing), authentication requirements, rate limits, or response format. This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with zero waste. It's front-loaded and efficiently conveys the core purpose without any extraneous details, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete. It doesn't explain what information is returned (e.g., track details, playback status) or handle edge cases like no active playback. For a tool in a music playback context, this leaves gaps in understanding its full behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description appropriately doesn't mention parameters, making a baseline score of 4 justified as it doesn't add unnecessary information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'currently playing track', making the purpose immediately understandable. It doesn't specifically differentiate from siblings like 'play_track' or 'pause_playback', but the action is distinct enough to avoid confusion.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. For example, it doesn't clarify if this should be used for checking playback status versus other tools like 'play_track' or 'skip_to_next', leaving the agent to infer usage from context alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MadhurToshniwal/Spotify-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server