Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

get_release_rating_by_user

Retrieve a user's rating for a specific Discogs music release. Provide the username and release ID to get their personal rating.

Instructions

Retrieves the release's rating for a given user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYes
release_idYes

Implementation Reference

  • The main handler for the MCP tool 'get_release_rating_by_user'. It instantiates ReleaseService and calls getRatingByUser to fetch the rating, then stringifies and returns it.
    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);
        }
      },
    };
  • The supporting service method that performs the actual API request to Discogs for the user's release rating 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)}`);
      }
    }
  • Zod schema for the tool input parameters: username and release_id.
    /**
     * Schema for release rating parameters
     */
    export const ReleaseRatingParamsSchema = UsernameInputSchema.merge(ReleaseIdParamSchema);
  • The line where the tool is registered with the MCP server.
    server.addTool(getReleaseRatingTool);

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