get_list
Retrieve a specific Discogs music collection list using its unique ID to access saved records, artists, or releases.
Instructions
Get a list by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | Yes |
Implementation Reference
- src/tools/userLists.ts:31-45 (handler)The MCP tool handler for 'get_list', including name, description, parameters schema, and execute function that instantiates ListService and calls getList on the provided args.export const getListTool: Tool<FastMCPSessionAuth, typeof ListIdParamSchema> = { name: 'get_list', description: `Get a list by ID`, parameters: ListIdParamSchema, execute: async (args) => { try { const listService = new ListService(); const list = await listService.getList(args); return JSON.stringify(list); } catch (error) { throw formatDiscogsError(error); } }, };
- src/types/list.ts:51-53 (schema)Zod input schema for the get_list tool parameters, requiring a numeric list_id.export const ListIdParamSchema = z.object({ list_id: z.number(), });
- src/tools/userLists.ts:47-50 (registration)Registration of the get_list tool (and get_user_lists) on the FastMCP server instance.export function registerUserListsTools(server: FastMCP): void { server.addTool(getUserListsTool); server.addTool(getListTool); }
- src/services/list.ts:22-38 (helper)Core helper function in ListService that performs the Discogs API request to fetch the list by ID and validates the response with ListSchema.async getList({ list_id }: ListIdParam): Promise<List> { try { const response = await this.request<List>(`/${list_id}`); // Validate the response using Zod schema const validatedResponse = ListSchema.parse(response); return validatedResponse; } catch (error) { // If it's already a Discogs error, just rethrow it if (isDiscogsError(error)) { throw error; } // For validation errors or other unexpected errors, wrap them throw new Error(`Failed to get list: ${String(error)}`); } }