Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

get_user_submissions

Retrieve a user's submissions by username from Discogs to view their contributions to the music database.

Instructions

Retrieve a user's submissions by username

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYes

Implementation Reference

  • MCP tool definition and handler (execute function) for 'get_user_submissions'. It uses UserSubmissionsService to fetch the user's submissions by username and returns JSON stringified response.
    export const getUserSubmissionsTool: Tool<FastMCPSessionAuth, typeof UsernameInputSchema> = {
      name: 'get_user_submissions',
      description: `Retrieve a user's submissions by username`,
      parameters: UsernameInputSchema,
      execute: async (args) => {
        try {
          const userSubmissionsService = new UserSubmissionsService();
          const submissions = await userSubmissionsService.get(args);
    
          return JSON.stringify(submissions);
        } catch (error) {
          throw formatDiscogsError(error);
        }
      },
    };
  • Input schema for the tool: requires a 'username' string.
    export const UsernameInputSchema = z.object({
      username: z.string().min(1, 'username is required'),
    });
  • Registers the getUserSubmissionsTool to the FastMCP server instance.
    server.addTool(getUserSubmissionsTool);
  • Top-level registration of user identity tools, which includes get_user_submissions.
    registerUserIdentityTools(server);
  • Supporting service class UserSubmissionsService with get method that makes the API request to Discogs /${username}/submissions endpoint and handles validation and errors.
    export class UserSubmissionsService extends BaseUserService {
      /**
       * Retrieve a user's submissions by username
       *
       * @param username The username of the user to get submissions for
       * @throws {DiscogsResourceNotFoundError} If the username is not found
       * @throws {DiscogsError} If there's an unexpected error
       * @returns {SubmissionResponse} The user's submissions
       */
      async get({ username }: UsernameInput): Promise<SubmissionResponse> {
        try {
          const response = await this.request<SubmissionResponse>(`/${username}/submissions`);
    
          const validatedResponse = SubmissionsResponseSchema.parse(response);
          return validatedResponse;
        } catch (error) {
          if (isDiscogsError(error)) {
            throw error;
          }
    
          throw new Error(`Failed to get user submissions: ${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