Skip to main content
Glama

Discogs MCP Server

by cswkim
inventory.ts1.3 kB
import { isDiscogsError } from '../../errors.js'; import { type UserInventoryGetParams, type UserInventoryResponse, UserInventoryResponseSchema, } from '../../types/user/index.js'; import { BaseUserService } from '../index.js'; /** * Service for Discogs User Inventory operations */ export class UserInventoryService extends BaseUserService { /** * Returns the list of listings in a user's inventory * @param params - Parameters for the request including username and optional pagination/sorting * @returns {UserInventoryResponse} A paginated response containing the user's inventory * @throws {DiscogsResourceNotFoundError} If the username cannot be found * @throws {Error} If there's an unexpected error */ 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)}`); } } }

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