Skip to main content
Glama

play-track

Play a selected Spotify track on your active or specified device using track ID. Control playback directly through the MCP Claude Spotify integration for streamlined music management.

Instructions

Play a specific track on an active device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceIdNoSpotify ID of the device to play on (optional)
trackIdYesSpotify ID of the track to play

Implementation Reference

  • The handler logic for the 'play-track' tool. It validates input using PlayTrackSchema, determines the playback endpoint (with optional device_id), sends a PUT request to Spotify API to play the specified track URI, and returns a success message.
    if (name === "play-track") {
      const { trackId, deviceId } = PlayTrackSchema.parse(args);
      
      const endpoint = deviceId ? `/me/player/play?device_id=${deviceId}` : "/me/player/play";
      
      await spotifyApiRequest(endpoint, "PUT", {
        uris: [`spotify:track:${trackId}`],
      });
      
      return {
        content: [
          {
            type: "text",
            text: `Started playing track with ID: ${trackId}`,
          },
        ],
      };
    }
  • Zod schema definition for validating the input parameters of the 'play-track' tool: required trackId (string) and optional deviceId (string). Used in the handler for parsing arguments.
    const PlayTrackSchema = z.object({
      trackId: z.string(),
      deviceId: z.string().optional(),
    });
  • index.ts:671-687 (registration)
    Tool registration in the ListTools response, defining the 'play-track' tool's name, description, and input schema matching the Zod schema.
      name: "play-track",
      description: "Play a specific track on an active device",
      inputSchema: {
        type: "object",
        properties: {
          trackId: {
            type: "string",
            description: "Spotify ID of the track to play",
          },
          deviceId: {
            type: "string",
            description: "Spotify ID of the device to play on (optional)",
          },
        },
        required: ["trackId"],
      },
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions playing on an 'active device' but doesn't explain what happens if no device is active, whether this requires specific permissions (e.g., Spotify Premium), if it interrupts current playback, or what the response looks like. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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, efficient sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core action ('Play a specific track'), making it easy to grasp quickly. Every part of the sentence earns its place by specifying the resource and context.

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 the tool's complexity (a mutation operation with no annotations and no output schema), the description is incomplete. It doesn't address key contextual aspects like error conditions (e.g., invalid track ID, no active device), behavioral outcomes (e.g., playback state changes), or integration with sibling tools (e.g., using 'get-current-playback' first). For a tool that modifies system state, more detail is needed to guide effective use.

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

Parameters3/5

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

The description adds no parameter-specific information beyond what the input schema provides, which has 100% coverage with clear descriptions for both 'deviceId' (optional Spotify ID) and 'trackId' (required Spotify ID). Since the schema fully documents parameters, the baseline score of 3 is appropriate, as the description doesn't enhance or clarify semantics further.

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 action ('Play') and resource ('a specific track on an active device'), making the tool's purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'next-track' or 'previous-track', which also control playback, nor does it clarify what constitutes an 'active device' versus using 'get-current-playback' to check status.

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 minimal guidance, stating only that it plays a track on an active device. It doesn't specify when to use this tool versus alternatives like 'next-track' for sequential playback, 'search-spotify' to find tracks first, or 'get-current-playback' to verify device status. No exclusions or prerequisites are mentioned, leaving usage context vague.

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

Related 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/imprvhub/mcp-claude-spotify'

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