set_variable_value
Change a variable's value in a paused debugging session. Specify session, call frame, scope index, variable name, and a JavaScript expression for the new value to test scenarios or fix values during debugging.
Instructions
Modifies the value of a variable in a specific call frame. Use this to test different scenarios or fix values during debugging.
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": {
"session_id": "<session_id>",
"call_frame_id": "<call_frame_id>",
"scope_index": "<scope_index>",
"variable_name": "<variable_name>",
"new_value": "<new_value>"
},
"name": "set_variable_value"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | ID of the debugging session. The session must be paused. | |
| call_frame_id | Yes | ID of the call frame containing the variable. Obtain from get_call_stack. | |
| scope_index | Yes | Index of the scope containing the variable. 0 is the local scope. | |
| variable_name | Yes | Name of the variable to modify. | |
| new_value | Yes | JavaScript expression that evaluates to the new value. Examples: "42", "'new string'", "{a: 1, b: 2}", "null" |