Skip to main content
Glama

checkUsersSavedAlbums

Verify which albums are saved in your Spotify library by checking up to 20 album IDs at once. This tool helps you confirm album status in "Your Music" without manual searching.

Instructions

Check if albums are saved in the user's "Your Music" library

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
albumIdsYesArray of Spotify album IDs to check (max 20)

Implementation Reference

  • The main handler function for the 'checkUsersSavedAlbums' tool. It validates input, calls the Spotify API to check saved status for the provided album IDs, formats the results, and returns a markdown response with the status of each album.
    handler: async (args, _extra: SpotifyHandlerExtra) => { const { albumIds } = args; if (albumIds.length === 0) { return { content: [ { type: 'text', text: 'Error: No album IDs provided', }, ], }; } try { const savedStatus = await handleSpotifyRequest(async (spotifyApi) => { return await spotifyApi.currentUser.albums.hasSavedAlbums(albumIds); }); const formattedResults = albumIds .map((albumId, i) => { const isSaved = savedStatus[i]; return `${i + 1}. ${albumId}: ${isSaved ? 'Saved' : 'Not saved'}`; }) .join('\n'); return { content: [ { type: 'text', text: `# Album Save Status\n\n${formattedResults}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error checking saved albums: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } },
  • Zod schema defining the input parameters for the tool: an array of up to 20 Spotify album IDs.
    schema: { albumIds: z .array(z.string()) .max(20) .describe('Array of Spotify album IDs to check (max 20)'), },
  • src/index.ts:12-14 (registration)
    Registration of all tools, including 'checkUsersSavedAlbums' from albumTools, by calling server.tool() with name, description, schema, and handler.
    [...readTools, ...playTools, ...albumTools].forEach((tool) => { server.tool(tool.name, tool.description, tool.schema, tool.handler); });
  • src/albums.ts:299-304 (registration)
    Export of albumTools array including the checkUsersSavedAlbums tool, which is later imported and registered in index.ts.
    export const albumTools = [ getAlbums, getAlbumTracks, saveOrRemoveAlbumForUser, checkUsersSavedAlbums, ];

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/makesh-kumar/spotify-mcp-server'

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