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.
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>",
"language": "<language>",
"code": "<code>"
},
"name": "run_local_tests"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Complete source code to execute. Should include test invocations that print results / raise on failure. | |
| language | Yes | Language to execute as. Currently runnable: python3, go, java. Other LeetCode languages remain valid for submit_solution. | |
| timeoutMs | No | Optional wall-clock budget in milliseconds. Defaults are language-specific. | |
| titleSlug | Yes | The URL slug of the problem (must match an active session opened with start_problem). |