Skip to main content
Glama

get_recently_played

Retrieve your recent Spotify listening history with timestamps to track music activity, rediscover songs, and analyze listening patterns.

Instructions

Access your complete recent listening history with timestamps for tracking music activity and rediscovering songs.

🎯 USE CASES: • Track recent music discovery and listening habits • Rediscover songs you heard but forgot to save • Build "Recently Discovered" playlists from history • Monitor listening patterns and music consumption • Create activity logs for music journaling

📝 WHAT IT RETURNS: • Chronological list of recently played tracks • Exact timestamps of when each track was played • Track information including artist, album, and duration • Play context (playlist, album, or individual play) • Device information where tracks were played

🔍 EXAMPLES: • "What have I been listening to recently?" • "Show my last 50 played tracks with timestamps" • "What songs did I discover today?" • "Get my recent listening history for this week"

⏰ LISTENING HISTORY: • Shows exact sequence of recent music activity • Includes partial plays and skips • Perfect for rediscovering forgotten gems • Great for tracking music exploration sessions • Useful for building "recently discovered" collections

💡 HISTORY BENEFITS: • Never lose track of songs you enjoyed • Monitor listening habits and patterns • Perfect for building discovery-based playlists • Great for social sharing of recent finds • Essential for music tracking and journaling

🎵 REDISCOVERY OPPORTUNITIES: • Find songs you heard but didn't save • Track down music from specific listening sessions • Identify patterns in your music exploration • Perfect for playlist creation from recent activity

⚠️ REQUIREMENTS: • Valid Spotify access token with user-read-recently-played scope • History shows approximately last 50 tracks played

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tokenYesSpotify access token for authentication
limitNo

Implementation Reference

  • The handler function for the 'get_recently_played' MCP tool. It destructures the token and limit from args and delegates to SpotifyService.getRecentlyPlayed.
    handler: async (args: any, spotifyService: SpotifyService) => {
      const { token, limit = 20 } = args;
      return await spotifyService.getRecentlyPlayed(token, limit);
    },
  • The input schema for the tool, defining required 'token' and optional 'limit' parameters using common schema builders.
    schema: createSchema({
      token: commonSchemas.token(),
      limit: commonSchemas.limit(1, 50, 20),
    }),
  • Central tools registry where trackTools (containing get_recently_played) is spread into allTools, used by ToolRegistrar for MCP tool registration.
    export const allTools: ToolsRegistry = {
      ...albumTools,
    
      ...artistTools,
    
      ...trackTools,
    
      ...playlistTools,
    
      ...playbackTools,
    
      ...userTools,
    
      ...searchTools,
    };
  • SpotifyService method that implements the core logic by calling Spotify API endpoint /me/player/recently-played to fetch user's recently played tracks.
    async getRecentlyPlayed(
      token: string,
      limit: number = 20
    ): Promise<PagingObject<RecentlyPlayedItem>> {
      const params = {
        limit: Math.min(limit, 50),
      };
      return await this.makeRequest<PagingObject<RecentlyPlayedItem>>(
        "me/player/recently-played",
        token,
        params
      );
    }
Behavior4/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 and does so effectively. It explains what the tool returns (chronological list with timestamps, track info, play context, device info), mentions partial plays and skips are included, and specifies the approximate limit of 50 tracks. The requirements section clearly states authentication needs (Spotify access token with specific scope).

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

Conciseness3/5

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

The description is well-structured with clear sections (use cases, returns, examples, etc.), but it's overly verbose with repetitive content. Sections like 'History Benefits' and 'Rediscovery Opportunities' largely reiterate points already made in 'Use Cases,' making it longer than necessary without adding substantial new information.

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

Completeness4/5

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

For a read-only tool with 2 parameters and no output schema, the description provides comprehensive context. It explains what data is returned, use cases, examples, behavioral details, and requirements. The main gap is the lack of explicit mention of the 'limit' parameter, but overall it gives the agent sufficient information to use the tool effectively.

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?

With 50% schema description coverage (only 'token' has a description), the description compensates well. While it doesn't explicitly mention the 'limit' parameter, it states 'History shows approximately last 50 tracks played,' which implies a maximum limit. The requirements section clarifies the authentication parameter's purpose beyond what the schema provides.

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

Purpose5/5

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

The description clearly states the tool's purpose with specific verbs ('access your complete recent listening history') and resources ('recently played tracks with timestamps'). It distinguishes itself from siblings like 'get_currently_playing' (current track) and 'get_liked_tracks' (saved songs) by focusing on chronological history with timestamps.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool through use cases like tracking recent music discovery, rediscovering forgotten songs, and building 'Recently Discovered' playlists. However, it doesn't explicitly state when NOT to use it or name specific alternatives among the sibling tools.

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/latiftplgu/Spotify-OAuth-MCP-server'

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