Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

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
NameRequiredDescriptionDefault
usernameYes
release_idYes
pageNo
per_pageNo
sortNo
sort_orderNo

Implementation Reference

  • 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); } }, };
  • 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()), );
  • 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)}`); } }

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