create_user_collection_folder
Create a new folder in a user's Discogs music collection to organize records, CDs, or other items by custom categories.
Instructions
Create a new folder in a user's collection
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | ||
| name | No |
Implementation Reference
- src/tools/userCollection.ts:43-60 (handler)MCP tool object defining the 'create_user_collection_folder' tool, including its execute handler that delegates to UserService.collection.createFolderexport const createUserCollectionFolderTool: Tool< FastMCPSessionAuth, typeof UserCollectionFolderCreateParamsSchema > = { name: 'create_user_collection_folder', description: `Create a new folder in a user's collection`, parameters: UserCollectionFolderCreateParamsSchema, execute: async (args) => { try { const userService = new UserService(); const folder = await userService.collection.createFolder(args); return JSON.stringify(folder); } catch (error) { throw formatDiscogsError(error); } }, };
- src/types/user/collection.ts:66-68 (schema)Zod schema defining the input parameters for the create_user_collection_folder tool (username and optional folder name)export const UserCollectionFolderCreateParamsSchema = UsernameInputSchema.extend({ name: z.string().optional(), });
- src/tools/userCollection.ts:320-335 (registration)Registration function that adds the create_user_collection_folder tool (and others) to the FastMCP server via server.addTool(createUserCollectionFolderTool)export function registerUserCollectionTools(server: FastMCP): void { server.addTool(getUserCollectionFoldersTool); server.addTool(createUserCollectionFolderTool); server.addTool(getUserCollectionFolderTool); server.addTool(editUserCollectionFolderTool); server.addTool(deleteUserCollectionFolderTool); server.addTool(findReleaseInUserCollectionTool); server.addTool(getUserCollectionItemsTool); server.addTool(addReleaseToUserCollectionFolderTool); server.addTool(rateReleaseInUserCollectionTool); server.addTool(moveReleaseInUserCollectionTool); server.addTool(deleteReleaseFromUserCollectionFolderTool); server.addTool(getUserCollectionCustomFieldsTool); server.addTool(editUserCollectionCustomFieldValueTool); server.addTool(getUserCollectionValueTool); }
- Core helper method in UserCollectionService that performs the actual Discogs API POST request to /${username}/collection/folders to create the folderasync createFolder({ username, ...body }: UserCollectionFolderCreateParams): Promise<UserCollectionFolder> { try { const response = await this.request<UserCollectionFolder>(`/${username}/collection/folders`, { method: 'POST', body, }); // Validate the response using Zod schema const validatedResponse = UserCollectionFolderSchema.parse(response); return validatedResponse; } catch (error) { if (isDiscogsError(error)) { throw error; } throw new Error(`Failed to create folder: ${String(error)}`); } }
- src/services/user/index.ts:9-21 (helper)UserService class that composes UserCollectionService as 'collection' property, used by the tool handler to access createFolder methodexport class UserService { public collection: UserCollectionService; public lists: UserListsService; public profile: UserProfileService; public wants: UserWantsService; constructor() { this.collection = new UserCollectionService(); this.lists = new UserListsService(); this.profile = new UserProfileService(); this.wants = new UserWantsService(); } }