get_artist_releases
Retrieve an artist's discography from Discogs by providing the artist ID, with options to sort by year, title, or format and control pagination.
Instructions
Get an artist's releases
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| artist_id | Yes | ||
| page | No | ||
| per_page | No | ||
| sort | No | ||
| sort_order | No |
Implementation Reference
- src/tools/database.ts:81-95 (handler)Defines the MCP tool 'get_artist_releases' with its execute handler that delegates to ArtistService.getReleases and returns JSON stringified response.export const getArtistReleasesTool: Tool<FastMCPSessionAuth, typeof ArtistReleasesParamsSchema> = { name: 'get_artist_releases', description: `Get an artist's releases`, parameters: ArtistReleasesParamsSchema, execute: async (args) => { try { const artistService = new ArtistService(); const artistReleases = await artistService.getReleases(args); return JSON.stringify(artistReleases); } catch (error) { throw formatDiscogsError(error); } }, };
- src/types/artist.ts:98-100 (schema)Zod schema defining the input parameters for the get_artist_releases tool, merging artist_id with query params.export const ArtistReleasesParamsSchema = ArtistIdParamSchema.merge( QueryParamsSchema(['year', 'title', 'format'] as const), );
- src/tools/database.ts:253-266 (registration)Function that registers all database-related tools, including getArtistReleasesTool, on the FastMCP server.export function registerDatabaseTools(server: FastMCP): void { server.addTool(getReleaseTool); server.addTool(getReleaseRatingTool); server.addTool(editReleaseRatingTool); server.addTool(deleteReleaseRatingTool); server.addTool(getReleaseCommunityRatingTool); server.addTool(getMasterReleaseTool); server.addTool(getMasterReleaseVersionsTool); server.addTool(getArtistTool); server.addTool(getArtistReleasesTool); server.addTool(getLabelTool); server.addTool(getLabelReleasesTool); server.addTool(searchTool); }
- src/services/artist.ts:51-66 (helper)Implementation in ArtistService that performs the HTTP request to Discogs API endpoint for retrieving the artist's releases, validates response, and handles errors.async getReleases({ artist_id, ...options }: ArtistReleasesParams): Promise<ArtistReleases> { try { const response = await this.request<ArtistReleases>(`/${artist_id}/releases`, { params: options, }); const validatedResponse = ArtistReleasesSchema.parse(response); return validatedResponse; } catch (error) { if (isDiscogsError(error)) { throw error; } throw new Error(`Failed to get artist releases: ${String(error)}`); } }