find_release_in_user_collection
Locate a specific music release in a user's Discogs collection by providing the username and release ID.
Instructions
Find a release in a user's collection
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | ||
| release_id | Yes | ||
| page | No | ||
| per_page | No | ||
| sort | No | ||
| sort_order | No |
Implementation Reference
- src/tools/userCollection.ts:153-170 (handler)MCP tool handler for 'find_release_in_user_collection'. It instantiates a UserService and delegates to its collection.findRelease method, returning the JSON-stringified result or formatted error.export const findReleaseInUserCollectionTool: Tool< FastMCPSessionAuth, typeof UserCollectionReleaseParamsSchema > = { name: 'find_release_in_user_collection', description: `Find a release in a user's collection`, parameters: UserCollectionReleaseParamsSchema, execute: async (args) => { try { const userService = new UserService(); const releases = await userService.collection.findRelease(args); return JSON.stringify(releases); } catch (error) { throw formatDiscogsError(error); } }, };
- src/types/user/collection.ts:114-116 (schema)Zod input schema for the tool parameters, merging UsernameInputSchema, ReleaseIdParamSchema (release_id), and QueryParamsSchema for pagination/search.export const UserCollectionReleaseParamsSchema = UsernameInputSchema.merge( ReleaseIdParamSchema.merge(QueryParamsSchema()), );
- src/tools/userCollection.ts:320-335 (registration)Registration function that adds the findReleaseInUserCollectionTool (line 326) along with other user collection tools to the FastMCP server.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 Discogs API GET request to /{username}/collection/releases/{release_id} with query parameters, validates the paginated response, and handles errors.async findRelease({ username, release_id, ...options }: UserCollectionReleaseParams): Promise<UserCollectionItemsByRelease> { try { const response = await this.request<UserCollectionItemsByRelease>( `/${username}/collection/releases/${release_id}`, { params: options, }, ); // Validate the response using Zod schema const validatedResponse = UserCollectionItemsByReleaseSchema.parse(response); return validatedResponse; } catch (error) { if (isDiscogsError(error)) { throw error; } // For unexpected errors, wrap them throw new Error(`Failed to find release in collection: ${String(error)}`); } }