Skip to main content
Glama

get_complexity

Analyze a LeetCode problem and your solution code to return time and space complexity with a clear explanation.

Instructions

Takes a LeetCode problem and the user's solution code, returns time and space complexity analysis with explanation.

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": {
      "problem": "<problem>",
      "solution_code": "<solution_code>"
    },
    "name": "get_complexity"
  }
}

Input Schema

NameRequiredDescriptionDefault
problemYesThe full LeetCode problem statement
solution_codeYesThe user's solution code to analyze

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.5/5.0
Behavior3/5

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

No annotations exist, so the description carries the full burden. It discloses the two outputs (time and space complexity) and that an explanation accompanies them, which is genuinely useful, but says nothing about read-only/non-mutating nature being safe, how large inputs are handled, or whether unsupported/non-LeetCode code is rejected.

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?

A single front-loaded sentence with zero filler: inputs first, outputs second. It is compact and readable, though it could be marginally tighter by dropping 'the user's'.

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

Completeness4/5

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

For a simple two-required-string tool with no output schema, the description covers the contract: what goes in and what comes back. The remaining gap — no note on language support or handling of malformed input — is minor at this complexity level.

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%, so both parameters are already documented in the schema as the full problem statement and the user's code. The description echoes those two inputs but adds no format or size guidance beyond what the schema provides, so the baseline of 3 applies.

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 states a specific verb and resource: it takes a LeetCode problem plus solution code and returns time and space complexity analysis with explanation. That is enough for an agent to tell it apart from siblings like get_approach or get_hint, though it never names those alternatives explicitly.

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?

Usage is only implied: use it when you have a solution and want its complexity. There is no explicit when-to-use/when-not framing and no mention of prerequisites, such as whether the problem statement must be pasted in full or whether the code must be in a supported language.

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