Skip to main content
Glama
cswkim

Discogs MCP Server

by cswkim

get_user_identity

Fetch authenticated user details from Discogs API to access personal account information or manage music collections.

Instructions

Retrieve basic information about the authenticated user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Defines the MCP 'get_user_identity' tool handler, which executes by creating an OAuthService instance and calling getUserIdentity(), returning the JSON stringified result.
    export const getUserIdentityTool: Tool<FastMCPSessionAuth, ToolParameters> = { name: 'get_user_identity', description: 'Retrieve basic information about the authenticated user', parameters: z.object({}), execute: async () => { try { const oauthService = new OAuthService(); const identity = await oauthService.getUserIdentity(); return JSON.stringify(identity); } catch (error) { throw formatDiscogsError(error); } }, };
  • Zod schema used to validate the output/response from the Discogs /oauth/identity endpoint.
    export const DiscogsUserIdentitySchema = z.object({ id: z.number(), username: z.string(), resource_url: z.string().url(), consumer_name: z.string(), });
  • Registers the get_user_identity tool with the FastMCP server.
    server.addTool(getUserIdentityTool);
  • Core helper method in OAuthService that performs the authenticated request to Discogs /oauth/identity and validates the response.
    async getUserIdentity(): Promise<DiscogsUserIdentity> { try { // Call the identity endpoint relative to the OAuth base path const response = await this.request<DiscogsUserIdentity>('/identity'); // Validate the response using Zod schema const validatedResponse = DiscogsUserIdentitySchema.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 identity: ${String(error)}`); } }
  • Top-level registration call that includes adding the get_user_identity tool via registerUserIdentityTools.
    registerUserIdentityTools(server);

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