Skip to main content
Glama
igorgarbuz

Spotify MCP Node Server

by igorgarbuz

getFollowedArtists

Retrieve a list of artists you follow on Spotify with pagination support for browsing large collections.

Instructions

Get a list of artists the user is following on Spotify

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
afterNoThe last artist ID from the previous request. Cursor for pagination.
limitNoMaximum number of artists to return (1-50)

Implementation Reference

  • Full implementation of the 'getFollowedArtists' tool, including input schema validation with Zod and the async handler that fetches and formats the list of followed artists using Spotify's currentUser.followedArtists API endpoint.
    const getFollowedArtists: tool<{
      after: z.ZodOptional<z.ZodString>;
      limit: z.ZodOptional<z.ZodNumber>;
    }> = {
      name: 'getFollowedArtists',
      description: 'Get a list of artists the user is following on Spotify',
      schema: {
        after: z
          .string()
          .optional()
          .describe(
            'The last artist ID from the previous request. Cursor for pagination.',
          ),
        limit: z
          .number()
          .min(1)
          .max(50)
          .optional()
          .describe('Maximum number of artists to return (1-50)'),
      },
      handler: async (args, extra: SpotifyHandlerExtra) => {
        const { limit = 50, after } = args;
    
        const artists = await handleSpotifyRequest(async (spotifyApi) => {
          return await spotifyApi.currentUser.followedArtists(
            after,
            limit as MaxInt<50>,
          );
        });
    
        if (artists.artists.items.length === 0) {
          return {
            content: [
              {
                type: 'text',
                text: "User doesn't follow any artists on Spotify",
              },
            ],
          };
        }
    
        const formattedArtists = artists.artists.items
          .map((artist, i) => {
            return `${i + 1}. "${artist.name}" - ID: ${artist.id}`;
          })
          .join('\n');
    
        return {
          content: [
            {
              type: 'text',
              text: `# Artists You Follow\n\n${formattedArtists}`,
            },
          ],
        };
      },
    };
  • src/read.ts:521-529 (registration)
    Adds 'getFollowedArtists' to the readTools export array, which collects all read-related tools for registration.
    export const readTools = [
      searchSpotify,
      getNowPlaying,
      getUserPlaylists,
      getPlaylistTracks,
      getRecentlyPlayed,
      getFollowedArtists,
      getUserTopItems,
    ];
  • src/index.ts:4-14 (registration)
    Imports readTools and registers all tools (including getFollowedArtists) with the MCP server by calling server.tool() for each.
    import { readTools } from './read.js';
    import { writeTools } from './write.js';
    
    const server = new McpServer({
      name: 'spotify-controller',
      version: '1.0.0',
    });
    
    [...playTools, ...readTools, ...writeTools].forEach((tool) => {
      server.tool(tool.name, tool.description, tool.schema, tool.handler);
    });
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic action without behavioral details. It doesn't disclose authentication requirements, rate limits, pagination behavior (implied by 'after' parameter but not explained), or response format, which are critical for a read operation.

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 front-loads the core purpose without unnecessary words. Every part earns its place, making it highly concise and well-structured for quick understanding.

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 for a tool with parameters and complexity. It lacks details on authentication, pagination behavior, response structure, and error handling, leaving significant gaps for the agent to operate effectively.

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?

Schema description coverage is 100%, so the schema fully documents both parameters ('after' for pagination cursor, 'limit' with range). The description adds no additional meaning beyond the schema, such as default values or usage examples, meeting the baseline for high coverage.

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 verb ('Get') and resource ('list of artists the user is following on Spotify'), making the purpose specific and unambiguous. It distinguishes this tool from siblings like 'getUserTopItems' or 'getRecentlyPlayed' by focusing exclusively on followed artists.

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. It doesn't mention prerequisites (e.g., user authentication), exclusions, or comparisons to sibling tools like 'getUserTopItems' for top artists, leaving the agent to infer usage context.

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/igorgarbuz/spotify-mcp'

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