Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

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
NameRequiredDescriptionDefault
list_idYes

Implementation Reference

  • 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); } }, };
  • Zod schema defining the input parameters for the 'get_list' tool: { list_id: number }.
    export const ListIdParamSchema = z.object({ list_id: z.number(), });
  • 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); }
  • 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)}`); } }

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