Skip to main content
Glama
jinzcdev

LeetCode MCP Server

get_user_profile

Retrieve LeetCode user profile data including stats, solved problems, and profile details by providing a username.

Instructions

Retrieves profile information about a LeetCode user, including user stats, solved problems, and profile details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesLeetCode username to retrieve profile information for

Implementation Reference

  • The inline async handler function for the get_user_profile tool. It takes a username, fetches the profile data from the LeetCode service, and returns it as a text content block containing JSON with the username and profile data.
    async ({ username }) => {
        const data =
            await this.leetcodeService.fetchUserProfile(username);
        return {
            content: [
                {
                    type: "text",
                    text: JSON.stringify({
                        username: username,
                        profile: data
                    })
                }
            ]
        };
    }
  • Zod input schema defining the required 'username' parameter as a string with description.
    {
        username: z
            .string()
            .describe(
                "LeetCode username to retrieve profile information for"
            )
    },
  • Registration of the 'get_user_profile' tool using server.tool(), including the tool name, description, input schema, and inline handler function within the UserToolRegistry's registerCommon method.
    this.server.tool(
        "get_user_profile",
        "Retrieves profile information about a LeetCode user, including user stats, solved problems, and profile details",
        {
            username: z
                .string()
                .describe(
                    "LeetCode username to retrieve profile information for"
                )
        },
        async ({ username }) => {
            const data =
                await this.leetcodeService.fetchUserProfile(username);
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify({
                            username: username,
                            profile: data
                        })
                    }
                ]
            };
        }
    );
Behavior2/5

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

No annotations are provided, so the description carries full burden. While it states this is a retrieval operation, it doesn't disclose behavioral traits like rate limits, authentication requirements, error conditions, response format, or whether this is a real-time or cached data source. For a tool with zero annotation coverage, this is a significant gap.

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

Conciseness4/5

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

The description is appropriately sized with a single sentence that efficiently communicates the core functionality. It's front-loaded with the main purpose and includes specific components. However, it could be slightly more structured by separating the what from the included components.

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

Completeness3/5

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

Given the tool's moderate complexity (user profile retrieval with multiple data components), no annotations, and no output schema, the description is minimally adequate. It identifies the resource and data components but lacks crucial operational context about behavior, limitations, and relationship to sibling tools. The absence of output schema means the description should ideally hint at return format.

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%, so the schema already documents the single username parameter. The description doesn't add any parameter semantics beyond what the schema provides - it doesn't specify username format requirements, validation rules, or examples. Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the tool retrieves LeetCode user profile information with specific components (stats, solved problems, profile details). It distinguishes from siblings by focusing on user profiles rather than challenges, problems, or submissions. However, it doesn't explicitly differentiate from get_user_contest_ranking which also relates to user data.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose get_user_profile over get_user_contest_ranking for ranking data, or when to use get_recent_ac_submissions versus this tool's solved problems information. No context about prerequisites or limitations is provided.

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