Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

get_release_rating_by_user

Retrieve a user's rating for a specific music release on Discogs by providing the username and release ID.

Instructions

Retrieves the release's rating for a given user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
release_idYes
usernameYes

Implementation Reference

  • MCP tool definition including the handler (execute function) for 'get_release_rating_by_user'. It creates a ReleaseService instance and calls getRatingByUser to fetch the rating, returning it as JSON.
    export const getReleaseRatingTool: Tool<FastMCPSessionAuth, typeof ReleaseRatingParamsSchema> = { name: 'get_release_rating_by_user', description: `Retrieves the release's rating for a given user`, parameters: ReleaseRatingParamsSchema, execute: async (args) => { try { const releaseService = new ReleaseService(); const releaseRating = await releaseService.getRatingByUser(args); return JSON.stringify(releaseRating); } catch (error) { throw formatDiscogsError(error); } }, };
  • Zod schema for the tool parameters: merges UsernameInputSchema and ReleaseIdParamSchema to validate {username, release_id}.
    export const ReleaseRatingParamsSchema = UsernameInputSchema.merge(ReleaseIdParamSchema);
  • Registration of the getReleaseRatingTool in the database tools registration function.
    server.addTool(getReleaseRatingTool);
  • Core helper function in ReleaseService that makes the Discogs API request to retrieve the user's rating for the release and validates the response.
    async getRatingByUser({ username, release_id }: ReleaseRatingParams): Promise<ReleaseRating> { try { const response = await this.request<ReleaseRating>(`/${release_id}/rating/${username}`); const validatedResponse = ReleaseRatingSchema.parse(response); return validatedResponse; } catch (error) { if (isDiscogsError(error)) { throw error; } throw new Error(`Failed to get release rating: ${String(error)}`); } }
  • src/index.ts:32-32 (registration)
    Top-level registration call that triggers the chain leading to adding the tool.
    registerTools(server);

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