Skip to main content
Glama

get_multiple_audiobooks

Retrieve Spotify catalog details for up to 50 audiobooks using their IDs or URIs, with optional market filtering.

Instructions

Get Spotify catalog information for multiple audiobooks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idsYesArray of Spotify audiobook IDs or URIs (max 50)
marketNoOptional. An ISO 3166-1 alpha-2 country code

Implementation Reference

  • The main handler function that executes the tool logic: validates input, extracts audiobook IDs, constructs the Spotify API endpoint, and returns the response.
    async getMultipleAudiobooks(args: MultipleAudiobooksArgs) { const { ids, market } = args; if (ids.length === 0) { throw new McpError( ErrorCode.InvalidParams, 'At least one audiobook ID must be provided' ); } if (ids.length > 50) { throw new McpError( ErrorCode.InvalidParams, 'Maximum of 50 audiobook IDs allowed' ); } const audiobookIds = ids.map(this.extractAudiobookId); const params = { market }; return this.api.makeRequest( `/audiobooks?ids=${audiobookIds.join(',')}${this.api.buildQueryString(params)}` ); }
  • src/index.ts:394-412 (registration)
    Tool registration in the MCP server's tools list, defining name, description, and input schema.
    { name: 'get_multiple_audiobooks', description: 'Get Spotify catalog information for multiple audiobooks', inputSchema: { type: 'object', properties: { ids: { type: 'array', items: { type: 'string' }, description: 'Array of Spotify audiobook IDs or URIs (max 50)', maxItems: 50 }, market: { type: 'string', description: 'Optional. An ISO 3166-1 alpha-2 country code' } }, required: ['ids'] },
  • TypeScript interface defining the input arguments for the handler (ids array and optional market from base).
    export interface MultipleAudiobooksArgs extends MarketParams { ids: string[]; }
  • src/index.ts:813-818 (registration)
    Dispatch logic in the CallToolRequestSchema handler that invokes the specific audiobooks handler.
    case 'get_multiple_audiobooks': { const args = this.validateArgs<MultipleAudiobooksArgs>(request.params.arguments, ['ids']); const result = await this.audiobooksHandler.getMultipleAudiobooks(args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], };
  • Helper method used to normalize audiobook IDs/URIs by extracting the ID part.
    private extractAudiobookId(id: string): string { return id.startsWith('spotify:audiobook:') ? id.split(':')[2] : id; }

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

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