Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

edit_user_collection_custom_field_value

Update custom field values for releases in Discogs user collections to organize music catalog data according to personal preferences.

Instructions

Edit a custom field value for a release in a user's collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYes
folder_idYes
valueYes
release_idYes
instance_idYes
field_idYes

Implementation Reference

  • MCP tool definition and handler function that executes the tool by delegating to UserService.collection.editCustomFieldValue
    export const editUserCollectionCustomFieldValueTool: Tool<
      FastMCPSessionAuth,
      typeof UserCollectionCustomFieldEditParamsSchema
    > = {
      name: 'edit_user_collection_custom_field_value',
      description: `Edit a custom field value for a release in a user's collection`,
      parameters: UserCollectionCustomFieldEditParamsSchema,
      execute: async (args) => {
        try {
          const userService = new UserService();
          await userService.collection.editCustomFieldValue(args);
    
          return 'Custom field value edited successfully';
        } catch (error) {
          throw formatDiscogsError(error);
        }
      },
    };
  • Zod schema defining the input parameters for the tool
    export const UserCollectionCustomFieldEditParamsSchema = UsernameInputSchema.merge(
      FolderIdParamSchema().extend({
        value: z.string(),
        release_id: z.union([z.number(), z.string()]),
        instance_id: z.union([z.number(), z.string()]),
        field_id: z.number(),
      }),
    );
  • Registration of the tool with the FastMCP server in registerUserCollectionTools function
    server.addTool(editUserCollectionCustomFieldValueTool);
  • Core helper method in UserCollectionService that performs the HTTP POST request to the Discogs API to edit the custom field value
    async editCustomFieldValue({
      username,
      folder_id,
      release_id,
      instance_id,
      field_id,
      value,
    }: UserCollectionCustomFieldEditParams): Promise<void> {
      try {
        await this.request<void>(
          `/${username}/collection/folders/${folder_id}/releases/${release_id}/instances/${instance_id}/fields/${field_id}`,
          {
            method: 'POST',
            body: { value },
          },
        );
      } catch (error) {
        if (isDiscogsError(error)) {
          throw error;
        }
    
        throw new Error(`Failed to edit custom field value: ${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