Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

get_user_inventory

Retrieve a user's inventory listings from Discogs, filtered by status, sorted, and paginated for easy management of music collections.

Instructions

Returns the list of listings in a user's inventory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNo
per_pageNo
sortNo
sort_orderNo
statusNo
usernameYes

Implementation Reference

  • Defines the 'get_user_inventory' MCP tool, including name, description, parameters schema, and the execute handler that calls UserInventoryService.get(args).
    export const getUserInventoryTool: Tool<FastMCPSessionAuth, typeof UserInventoryGetParamsSchema> = { name: 'get_user_inventory', description: `Returns the list of listings in a user's inventory`, parameters: UserInventoryGetParamsSchema, execute: async (args) => { try { const userInventoryService = new UserInventoryService(); const inventory = await userInventoryService.get(args); return JSON.stringify(inventory); } catch (error) { throw formatDiscogsError(error); } }, };
  • Zod schema for input parameters of the get_user_inventory tool, extending UsernameInputSchema with optional status and query params.
    export const UserInventoryGetParamsSchema = UsernameInputSchema.extend({ status: SaleStatusSchema.optional(), }).merge( QueryParamsSchema([ 'listed', 'price', 'item', 'artist', 'label', 'catno', 'audio', 'status', 'location', ]), );
  • Registers the getUserInventoryTool with the FastMCP server.
    server.addTool(getUserInventoryTool);
  • The get method in UserInventoryService that performs the Discogs API request to fetch user inventory and validates the response.
    async get({ username, ...options }: UserInventoryGetParams): Promise<UserInventoryResponse> { try { const response = await this.request<UserInventoryResponse>(`/${username}/inventory`, { params: options, }); // Validate the response using Zod schema const validatedResponse = UserInventoryResponseSchema.parse(response); return validatedResponse; } catch (error) { if (isDiscogsError(error)) { throw error; } throw new Error(`Failed to get inventory: ${String(error)}`); } }
  • Calls registerMarketplaceTools in the top-level tool registration function, which includes get_user_inventory.
    registerMarketplaceTools(server);

Other Tools

Related Tools

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