Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

get_user_contributions

Retrieve a user's contributions from Discogs by username, with options to sort and paginate results for catalog management.

Instructions

Retrieve a user's contributions by username

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYes
pageNo
per_pageNo
sortNo
sort_orderNo

Implementation Reference

  • MCP tool definition for 'get_user_contributions', including the execute handler that calls UserContributionsService.get(args) and returns JSON.
    export const getUserContributionsTool: Tool<FastMCPSessionAuth, typeof ContributionsParamsSchema> =
      {
        name: 'get_user_contributions',
        description: `Retrieve a user's contributions by username`,
        parameters: ContributionsParamsSchema,
        execute: async (args) => {
          try {
            const userContributionsService = new UserContributionsService();
            const contributions = await userContributionsService.get(args);
    
            return JSON.stringify(contributions);
          } catch (error) {
            throw formatDiscogsError(error);
          }
        },
      };
  • Input parameters schema for the get_user_contributions tool, combining username input with query parameters for filtering contributions.
    export const ContributionsParamsSchema = UsernameInputSchema.merge(
      QueryParamsSchema([
        'label',
        'artist',
        'title',
        'catno',
        'format',
        'rating',
        'year',
        'added',
      ] as const),
    );
  • Registers the get_user_contributions tool on the FastMCP server.
    server.addTool(getUserContributionsTool);
  • Core logic in UserContributionsService.get() that fetches contributions from Discogs API endpoint '/{username}/contributions', handles errors, and validates response.
    async get({ username, ...options }: ContributionsParams): Promise<ContributionsResponse> {
      try {
        const response = await this.request<ContributionsResponse>(`/${username}/contributions`, {
          params: options,
        });
    
        const validatedResponse = ContributionsResponseSchema.parse(response);
        return validatedResponse;
      } catch (error) {
        if (isDiscogsError(error)) {
          throw error;
        }
    
        throw new Error(`Failed to get user contributions: ${String(error)}`);
      }
    }

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