get_marketplace_orders
Retrieve a list of marketplace orders on Discogs, filter by status, creation date, or archive status, and sort results by ID, buyer, or activity for efficient order management.
Instructions
Get a list of marketplace orders
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| archived | No | ||
| created_after | No | ||
| created_before | No | ||
| page | No | ||
| per_page | No | ||
| sort | No | ||
| sort_order | No | ||
| status | No |
Implementation Reference
- src/tools/marketplace.ts:122-136 (handler)The MCP tool definition including the execute handler function that instantiates MarketplaceService and calls getOrders to fetch and return the orders.export const getMarketplaceOrdersTool: Tool<FastMCPSessionAuth, typeof OrdersParamsSchema> = { name: 'get_marketplace_orders', description: 'Get a list of marketplace orders', parameters: OrdersParamsSchema, execute: async (args) => { try { const marketplaceService = new MarketplaceService(); const orders = await marketplaceService.getOrders(args); return JSON.stringify(orders); } catch (error) { throw formatDiscogsError(error); } }, };
- src/types/marketplace.ts:210-217 (schema)Zod schema for the input parameters of the get_marketplace_orders tool, including optional filters like status, date ranges, and pagination/sort via QueryParamsSchema.export const OrdersParamsSchema = z .object({ status: OrderStatusSchema.optional(), created_after: z.string().optional(), created_before: z.string().optional(), archived: z.boolean().optional(), }) .merge(QueryParamsSchema(['id', 'buyer', 'created', 'status', 'last_activity'] as const));
- src/tools/marketplace.ts:248-248 (registration)Registration of the getMarketplaceOrdersTool with the FastMCP server instance.server.addTool(getMarketplaceOrdersTool);
- src/services/marketplace.ts:205-220 (helper)The MarketplaceService.getOrders method, which makes the authenticated API request to Discogs /orders endpoint, validates the response, and handles errors.async getOrders(params: OrdersParams): Promise<OrdersResponse> { try { const response = await this.request<OrdersResponse>(`/orders`, { params, }); const validatedResponse = OrdersResponseSchema.parse(response); return validatedResponse; } catch (error) { if (isDiscogsError(error)) { throw error; } throw new Error(`Failed to get orders: ${String(error)}`); } }
- src/tools/index.ts:17-17 (registration)Higher-level registration call within registerTools that includes the marketplace tools registration.registerMarketplaceTools(server);