Skip to main content
Glama
jinzcdev

LeetCode MCP Server

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
NameRequiredDescriptionDefault
usernameYesLeetCode username to retrieve recent accepted submissions for
limitNoMaximum 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);
    }
  • 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
                                })
                            }
                        ]
                    };
                }
            }
        );
    }
  • 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
                            })
                        }
                    ]
                };
            }
        }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool retrieves data and focuses on accepted submissions, but fails to describe key behaviors such as response format, pagination, error handling, rate limits, or authentication needs. For a read operation without annotations, this leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Retrieves a user's recent accepted submissions') and adds necessary qualification ('on LeetCode Global, focusing only on successfully completed problems'). There is no wasted verbiage, and every part of the sentence contributes to clarifying the tool's intent.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for a tool with 2 parameters and no structured output information. It adequately states what the tool does but fails to provide sufficient context on behavior, return values, or usage nuances, which are critical for an AI agent to invoke it correctly without guesswork.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear documentation for both parameters in the input schema. The description does not add any additional meaning beyond what the schema provides, such as explaining parameter interactions or constraints. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description neither compensates nor detracts.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Retrieves'), target resource ('a user's recent accepted (AC) submissions on LeetCode Global'), and scope ('focusing only on successfully completed problems'). It distinguishes from sibling tools like 'get_recent_submissions' by specifying the AC (accepted) filter, making the purpose unambiguous and well-differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by specifying 'recent accepted submissions' and 'successfully completed problems', which suggests when to use it versus general submission tools. However, it lacks explicit guidance on when to choose this tool over alternatives like 'get_user_profile' or 'get_recent_submissions', or any prerequisites or exclusions, leaving some ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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