Skip to main content
Glama
LeetCode MCP Server

LeetCode MCP Server

get_problem

Retrieves a single LeetCode problem by its URL slug, returning the description, examples, constraints, and metadata as JSON for problem lookup and analysis.

Instructions

Retrieves a single LeetCode problem by titleSlug (read-only, no auth). Returns description, examples, constraints, and metadata as JSON. Use search_problems to find problems by keyword/tag/difficulty; use get_daily_challenge for today's featured problem.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "titleSlug": "<titleSlug>"
    },
    "name": "get_problem"
  }
}

Input Schema

NameRequiredDescriptionDefault
titleSlugYesProblem URL slug (e.g., 'two-sum', 'add-two-numbers')—the path segment after /problems/

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.5.0
  2. Removedv1.4.0
  3. First observed

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does disclose the safety profile ('read-only, no auth') plus the payload shape ('description, examples, constraints, and metadata as JSON'). It stops short of noting failure behavior for an invalid slug or any rate-limit/pagination concerns, so it is strong but not complete.

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?

Three compact sentences, each with a distinct job: what it returns, how it authenticates/behaves, and how it differs from siblings. Front-loaded with the core action and no filler.

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

Completeness5/5

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

For a single-parameter read tool with a 100%-covered schema and no output schema, the description supplies the return payload contents, the auth/safety stance, and sibling routing. An agent has everything needed to select and call it correctly.

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 coverage is 100% and the single titleSlug parameter is already fully documented with format examples in the schema. The description only restates 'by titleSlug' with no added syntax or edge-case guidance, so it earns the baseline 3 rather than more.

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?

Starts with a specific verb+resource ('Retrieves a single LeetCode problem') and explicitly scopes it to lookup by titleSlug. It also names the sibling tools it must be distinguished from, so an agent can disambiguate without opening any schema.

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

Usage Guidelines5/5

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

Gives explicit routing: 'Use search_problems to find problems by keyword/tag/difficulty; use get_daily_challenge for today's featured problem.' Both the condition and the alternative are named, leaving nothing to inference.

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