Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

get_artist

Retrieve detailed artist information from Discogs by providing a specific artist ID. Simplify music catalog management and enhance your Discogs collection with accurate metadata.

Instructions

Get an artist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
artist_idYes

Implementation Reference

  • Tool definition and handler (execute function) for 'get_artist', which uses ArtistService to fetch artist data by ID and returns JSON string.
    export const getArtistTool: Tool<FastMCPSessionAuth, typeof ArtistIdParamSchema> = { name: 'get_artist', description: 'Get an artist', parameters: ArtistIdParamSchema, execute: async (args) => { try { const artistService = new ArtistService(); const artist = await artistService.get(args); return JSON.stringify(artist); } catch (error) { throw formatDiscogsError(error); } }, };
  • Input schema defining the required 'artist_id' number parameter for the get_artist tool.
    export const ArtistIdParamSchema = z.object({ artist_id: z.number(), });
  • Registration of the get_artist tool via server.addTool in the registerDatabaseTools function.
    server.addTool(getArtistTool);
  • Output validation schema (ArtistSchema) used in ArtistService to parse the fetched artist data.
    export const ArtistSchema = z.object({ id: z.number(), aliases: z .array( z.object({ id: z.number(), name: z.string(), resource_url: urlOrEmptySchema(), thumbnail_url: urlOrEmptySchema().optional(), }), ) .optional(), data_quality: z.string().optional(), images: z.array(ImageSchema).optional(), members: z .array( z.object({ id: z.number(), active: z.boolean().optional(), name: z.string(), resource_url: urlOrEmptySchema(), thumbnail_url: urlOrEmptySchema().optional(), }), ) .optional(), name: z.string(), namevariations: z.array(z.string()).optional(), profile: z.string().optional(), realname: z.string().optional(), releases_url: urlOrEmptySchema().optional(), resource_url: urlOrEmptySchema(), uri: urlOrEmptySchema().optional(), urls: z.array(z.string()).optional(), });
  • ArtistService.get method, which performs the HTTP request to Discogs API for the artist and validates with ArtistSchema.
    async get({ artist_id }: ArtistIdParam): Promise<Artist> { try { const response = await this.request<Artist>(`/${artist_id}`); const validatedResponse = ArtistSchema.parse(response); return validatedResponse; } catch (error) { if (isDiscogsError(error)) { throw error; } throw new Error(`Failed to get artist: ${String(error)}`); } }

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/cswkim/discogs-mcp-server'

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