Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

edit_user_profile

Update user profile information on Discogs, including name, location, website, currency preference, and personal bio.

Instructions

Edit a user's profile data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYes
nameNo
home_pageNo
locationNo
profileNo
curr_abbrNo

Implementation Reference

  • Tool definition and execute handler for 'edit_user_profile', which invokes the UserService to perform the profile edit.
    export const editUserProfileTool: Tool<FastMCPSessionAuth, typeof UserProfileEditInputSchema> = {
      name: 'edit_user_profile',
      description: `Edit a user's profile data`,
      parameters: UserProfileEditInputSchema,
      execute: async (args) => {
        try {
          const userService = new UserService();
          const profile = await userService.profile.edit(args);
    
          return JSON.stringify(profile);
        } catch (error) {
          throw formatDiscogsError(error);
        }
      },
    };
  • Zod input schema for validating parameters to the edit_user_profile tool.
    export const UserProfileEditInputSchema = z.object({
      ...UsernameInputSchema.shape,
      name: z.string().optional(),
      home_page: urlOrEmptySchema().optional(),
      location: z.string().optional(),
      profile: z.string().optional(),
      curr_abbr: CurrencyCodeSchema.optional(),
    });
  • Registration function that adds the editUserProfileTool to the MCP server.
    export function registerUserIdentityTools(server: FastMCP): void {
      server.addTool(getUserIdentityTool);
      server.addTool(getUserProfileTool);
      server.addTool(editUserProfileTool);
      server.addTool(getUserSubmissionsTool);
      server.addTool(getUserContributionsTool);
    }
  • Core implementation of profile editing via POST request to Discogs API, called by the tool handler.
    async edit({ username, ...body }: UserProfileEditInput): Promise<UserProfile> {
      try {
        const response = await this.request<UserProfile>(`/${username}`, {
          method: 'POST',
          body,
        });
    
        // Validate the response using Zod schema
        const validatedResponse = UserProfileSchema.parse(response);
        return validatedResponse;
      } catch (error) {
        // If it's already a Discogs error, just rethrow it
        if (isDiscogsError(error)) {
          throw error;
        }
    
        // For validation errors or other unexpected errors, wrap them
        throw new Error(`Failed to edit profile: ${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