get_recent_ac_submissions
Retrieve a user's recently accepted LeetCode submissions to track solved problems and monitor coding progress.
Instructions
Retrieves a user's recent accepted (AC) submissions on LeetCode Global, focusing only on successfully completed problems
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | LeetCode username to retrieve recent accepted submissions for | |
| limit | No | Maximum number of accepted submissions to return (optional, defaults to server-defined limit) |
Implementation Reference
- Handler implementation for fetching recent accepted submissions on LeetCode Global using a GraphQL query to 'recentAcSubmissionList'.async fetchUserRecentACSubmissions( username: string, limit?: number ): Promise<any> { return await this.leetCodeApi.graphql({ query: ` query ($username: String!, $limit: Int) { recentAcSubmissionList(username: $username, limit: $limit) { id title titleSlug time timestamp statusDisplay lang } } `, variables: { username, limit } }); }
- Handler implementation for fetching recent accepted submissions on LeetCode CN using the leetCodeApi.recent_submissions method (ignores limit).async fetchUserRecentACSubmissions( username: string, limit?: number ): Promise<any> { return await this.leetCodeApi.recent_submissions(username); }
- src/mcp/tools/user-tools.ts:96-146 (registration)Registration of 'get_recent_ac_submissions' tool for Global LeetCode, with input schema (username, optional limit) and handler that delegates to leetcodeService and returns JSON response.this.server.tool( "get_recent_ac_submissions", "Retrieves a user's recent accepted (AC) submissions on LeetCode Global, focusing only on successfully completed problems", { username: z .string() .describe( "LeetCode username to retrieve recent accepted submissions for" ), limit: z .number() .optional() .default(10) .describe( "Maximum number of accepted submissions to return (optional, defaults to server-defined limit)" ) }, async ({ username, limit }) => { try { const data = await this.leetcodeService.fetchUserRecentACSubmissions( username, limit ); return { content: [ { type: "text", text: JSON.stringify({ username, submissions: data }) } ] }; } catch (error: any) { return { content: [ { type: "text", text: JSON.stringify({ error: "Failed to fetch recent submissions", message: error.message }) } ] }; } } ); }
- src/mcp/tools/user-tools.ts:150-199 (registration)Registration of 'get_recent_ac_submissions' tool for LeetCode China, with input schema (username, optional limit) and handler that delegates to leetcodeService and returns JSON response.this.server.tool( "get_recent_ac_submissions", "Retrieves a user's recent accepted (AC) submissions on LeetCode China, with details about each successfully solved problem", { username: z .string() .describe( "LeetCode China username to retrieve recent accepted submissions for" ), limit: z .number() .optional() .default(10) .describe( "Maximum number of accepted submissions to return (optional, defaults to server-defined limit)" ) }, async ({ username, limit }) => { try { const data = await this.leetcodeService.fetchUserRecentACSubmissions( username, limit ); return { content: [ { type: "text", text: JSON.stringify({ username, acSubmissions: data }) } ] }; } catch (error: any) { return { content: [ { type: "text", text: JSON.stringify({ error: "Failed to fetch recent AC submissions", message: error.message }) } ] }; } } );