Skip to main content
Glama

get-user-playlists

Retrieve a comprehensive list of Spotify playlists from the user's account, enabling easy access and management through the MCP Claude Spotify integration.

Instructions

Get a list of the user's playlists

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'get-user-playlists' tool. Parses input arguments using GetUserPlaylistsSchema, fetches user's playlists from Spotify API endpoint '/me/playlists', formats the response with playlist details and pagination info.
          if (name === "get-user-playlists") {
            const { limit, offset } = GetUserPlaylistsSchema.parse(args);
    
            const params = new URLSearchParams({
              limit: limit.toString(),
              offset: offset.toString(),
            });
    
            const playlists = await spotifyApiRequest(`/me/playlists?${params}`);
    
            if (playlists.items.length === 0) {
              return {
                content: [
                  {
                    type: "text",
                    text: offset > 0
                      ? "No more playlists found."
                      : "You don't have any playlists.",
                  },
                ],
              };
            }
    
            const formattedPlaylists = playlists.items
              .map(
                (playlist: any) => `
    Name: ${playlist.name}
    ID: ${playlist.id}
    Owner: ${playlist.owner.display_name}
    Tracks: ${playlist.tracks.total}
    Public: ${playlist.public ? "Yes" : "No"}
    URL: ${playlist.external_urls.spotify}
    ---`
              )
              .join("\n");
    
            const paginationInfo = `
    Showing ${offset + 1}-${offset + playlists.items.length} of ${playlists.total} total playlists`;
    
            return {
              content: [
                {
                  type: "text",
                  text: `Your playlists:${paginationInfo}\n${formattedPlaylists}`,
                },
              ],
            };
          }
  • Zod schema for validating input parameters of the get-user-playlists tool: limit (1-50, default 20) and offset (default 0). Used in the handler.
    const GetUserPlaylistsSchema = z.object({
      limit: z.number().min(1).max(50).default(20),
      offset: z.number().min(0).default(0),
    });
  • index.ts:712-728 (registration)
    Tool registration in ListToolsRequestHandler, including name, description, and input schema matching the Zod schema.
    {
      name: "get-user-playlists",
      description: "Get a list of the user's playlists",
      inputSchema: {
        type: "object",
        properties: {
          limit: {
            type: "number",
            description: "Maximum number of playlists to return (1-50, default: 20)",
          },
          offset: {
            type: "number",
            description: "The index of the first playlist to return (default: 0)",
          },
        },
      },
    },
Behavior2/5

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

With no annotations, the description carries full burden but only states the action without disclosing behavioral traits. It doesn't cover permissions needed, rate limits, response format (e.g., pagination, fields returned), or side effects, which are critical for a tool that likely requires user authentication and returns data.

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 with no wasted words. It's front-loaded and directly states the tool's function, making it easy to parse quickly.

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, no output schema, and the tool's likely complexity (involving user data and authentication), the description is incomplete. It lacks details on authentication needs, return values, or error handling, leaving significant gaps for an AI agent to use it 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?

The tool has 0 parameters with 100% schema coverage, so no parameter documentation is needed. The description doesn't add param info, but that's fine here; baseline is 4 for zero params, as it avoids redundancy and the schema fully covers the absence of inputs.

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 resource ('list of the user's playlists'), making the purpose understandable. However, it doesn't differentiate from siblings like 'create-playlist' or 'search-spotify' beyond the obvious 'get' vs 'create/search' distinction, lacking specificity about scope or format.

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?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., user authentication), context (e.g., for browsing or selecting playlists), or exclusions (e.g., not for modifying playlists), leaving usage unclear.

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