Skip to main content
Glama

get_recent_submissions

Retrieve recent LeetCode submissions for a user, including accepted and failed attempts with detailed metadata, to track coding progress and analyze problem-solving patterns.

Instructions

Retrieves a user's recent submissions on LeetCode Global, including both accepted and failed submissions with detailed metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesLeetCode username to retrieve recent submissions for
limitNoMaximum number of submissions to return (optional, defaults to server-defined limit)

Implementation Reference

  • Registration of the MCP tool 'get_recent_submissions' including description, Zod input schema, and inline async handler function that calls leetcodeService and formats response as MCP content.
    "get_recent_submissions", "Retrieves a user's recent submissions on LeetCode Global, including both accepted and failed submissions with detailed metadata", { username: z .string() .describe( "LeetCode username to retrieve recent submissions for" ), limit: z .number() .optional() .default(10) .describe( "Maximum number of submissions to return (optional, defaults to server-defined limit)" ) }, async ({ username, limit }) => { try { const data = await this.leetcodeService.fetchUserRecentSubmissions( 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 }) } ] }; } } );
  • The core handler function for the tool that executes the logic: fetches recent submissions from LeetCode service and returns formatted JSON response.
    async ({ username, limit }) => { try { const data = await this.leetcodeService.fetchUserRecentSubmissions( 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 }) } ] }; } }
  • Zod schema defining input parameters: username (required string) and limit (optional number, default 10).
    { username: z .string() .describe( "LeetCode username to retrieve recent submissions for" ), limit: z .number() .optional() .default(10) .describe( "Maximum number of submissions to return (optional, defaults to server-defined limit)" ) },
  • Supporting method in LeetCodeGlobalService that implements fetching recent submissions by delegating to the leetcode-query library's recent_submissions API.
    async fetchUserRecentSubmissions( username: string, limit?: number ): Promise<any> { return await this.leetCodeApi.recent_submissions(username, limit); }

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/jinzcdev/leetcode-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server