Skip to main content
Glama
SPerekrestova

Interactive LeetCode MCP

run_local_tests

Execute your solution locally with embedded test invocations to validate correctness before submitting, capturing output and exit code for rapid debugging without using a LeetCode submission.

Instructions

Runs the user's code locally in an isolated subprocess, captures stdout / stderr / exit code, and updates the session's lastLocalRunPassed flag. Use this in the inner loop instead of submit_solution — it costs no LeetCode submission and turns around in seconds. The agent is responsible for including test invocations (e.g. print(Solution().twoSum([2,7,11,15], 9))) in the code passed in. Currently runnable: python3, go, and java.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesComplete source code to execute. Should include test invocations that print results / raise on failure.
languageYesLanguage to execute as. Currently runnable: python3, go, java. Other LeetCode languages remain valid for submit_solution.
timeoutMsNoOptional wall-clock budget in milliseconds. Defaults are language-specific.
titleSlugYesThe URL slug of the problem (must match an active session opened with start_problem).
Behavior4/5

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

Describes isolated subprocess execution, output capture, flag update, and supported languages without annotations. Discloses optional timeout with language-specific defaults. Lacks details on resource limits or error handling but sufficient for most use cases.

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?

Four sentences with no fluff. Front-loaded with main purpose, then key usage guidance, then supported languages. Every sentence earns its place.

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?

Covers all essential aspects: execution environment, captured outputs, flag update, supported languages, prerequisite (active session), optional timeout. No output schema, but description sufficiently explains what the tool returns and does.

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

Parameters4/5

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

Schema coverage is 100%, but description adds critical context: code must include test invocations, language enum notes other languages valid for submit_solution, timeoutMs has language-specific defaults, titleSlug must match active session. Goes beyond mere schema definitions.

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?

Clearly states it runs user's code locally in isolated subprocess, captures output and exit code, and updates session flag. Distinguishes from submit_solution as inner-loop alternative with no submission cost and faster turnaround.

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?

Explicitly tells when to use ('inner loop instead of submit_solution'), highlights benefits (no cost, fast), and instructs the agent to include test invocations. Provides clear usage context.

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/SPerekrestova/interactive-leetcode-mcp'

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