get_list
Retrieve a specific list from Discogs using its unique ID to manage or view music catalog data efficiently within the Discogs MCP Server.
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)Defines the MCP tool 'get_list' including its handler (execute function) that instantiates ListService and calls getList to fetch the list by ID, then returns JSON string.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 schema defining the input parameters for the 'get_list' tool: { list_id: number }.export const ListIdParamSchema = z.object({ list_id: z.number(), });
- src/tools/userLists.ts:47-50 (registration)Registers the 'get_list' tool (along with 'get_user_lists') with the FastMCP server using server.addTool.export function registerUserListsTools(server: FastMCP): void { server.addTool(getUserListsTool); server.addTool(getListTool); }
- src/services/list.ts:22-38 (helper)ListService.getList method: performs the API request to fetch the list, validates with ListSchema, handles errors.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)}`); } }