get_user_submissions
Retrieve a user's submissions by username from Discogs to view their contributions to the music database.
Instructions
Retrieve a user's submissions by username
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes |
Implementation Reference
- src/tools/userIdentity.ts:52-66 (handler)MCP tool definition and handler (execute function) for 'get_user_submissions'. It uses UserSubmissionsService to fetch the user's submissions by username and returns JSON stringified response.export const getUserSubmissionsTool: Tool<FastMCPSessionAuth, typeof UsernameInputSchema> = { name: 'get_user_submissions', description: `Retrieve a user's submissions by username`, parameters: UsernameInputSchema, execute: async (args) => { try { const userSubmissionsService = new UserSubmissionsService(); const submissions = await userSubmissionsService.get(args); return JSON.stringify(submissions); } catch (error) { throw formatDiscogsError(error); } }, };
- src/types/common.ts:123-125 (schema)Input schema for the tool: requires a 'username' string.export const UsernameInputSchema = z.object({ username: z.string().min(1, 'username is required'), });
- src/tools/userIdentity.ts:111-111 (registration)Registers the getUserSubmissionsTool to the FastMCP server instance.server.addTool(getUserSubmissionsTool);
- src/tools/index.ts:19-19 (registration)Top-level registration of user identity tools, which includes get_user_submissions.registerUserIdentityTools(server);
- Supporting service class UserSubmissionsService with get method that makes the API request to Discogs /${username}/submissions endpoint and handles validation and errors.export class UserSubmissionsService extends BaseUserService { /** * Retrieve a user's submissions by username * * @param username The username of the user to get submissions for * @throws {DiscogsResourceNotFoundError} If the username is not found * @throws {DiscogsError} If there's an unexpected error * @returns {SubmissionResponse} The user's submissions */ async get({ username }: UsernameInput): Promise<SubmissionResponse> { try { const response = await this.request<SubmissionResponse>(`/${username}/submissions`); const validatedResponse = SubmissionsResponseSchema.parse(response); return validatedResponse; } catch (error) { if (isDiscogsError(error)) { throw error; } throw new Error(`Failed to get user submissions: ${String(error)}`); } } }