find_release_in_user_collection
Locate a specific release within a user's Discogs collection by providing the username, release ID, and optional pagination or sorting parameters. Integrates with the Discogs API for catalog management.
Instructions
Find a release in a user's collection
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | ||
| per_page | No | ||
| release_id | Yes | ||
| sort | No | ||
| sort_order | No | ||
| username | Yes |
Implementation Reference
- src/tools/userCollection.ts:153-170 (handler)The MCP tool handler for 'find_release_in_user_collection', which instantiates UserService and calls collection.findRelease(args) to retrieve matching releases from the user's Discogs collection.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 schema defining the input parameters for finding a release in a user's collection, merging username, release_id, and query params.export const UserCollectionReleaseParamsSchema = UsernameInputSchema.merge( ReleaseIdParamSchema.merge(QueryParamsSchema()), );
- src/tools/userCollection.ts:326-326 (registration)Registration of the tool with the FastMCP server instance.server.addTool(findReleaseInUserCollectionTool);
- The UserCollectionService.findRelease method that makes the Discogs API request to fetch releases matching the release_id in the user's collection, with validation and error handling.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)}`); } }