translate_to_source
Convert native-language Python code back to English-keyword Python so the interpreter, toolchain, and upstream collaborators receive the canonical source form.
Instructions
Translate native-language code back to English-keyword Python.
The inverse of translate_to_native and the round-trip half of the collaboration story: the output is the form the interpreter, the toolchain, and upstream collaborators use. The target is fixed to English — for a general X→Y translation call translate_to_native with an explicit source_lang.
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": {
"source": "<source>",
"source_lang": "<source_lang>"
},
"name": "translate_to_source"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | Python source text (a complete file or a fragment). | |
| source_lang | Yes | ISO 639 language code from the legesher://languages catalog. | |
| python_version | No | 3.13 | |
| verify_round_trip | No | Also verify the round trip: translate the result back, compare byte-for-byte, and check the canonical form compiles. Use this instead of comparing two renderings yourself — exact comparison over a long file is not a judgement to make by eye. Doubles translation cost; quadruples via a pivot. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pivoted | Yes | True when translated via the English pivot (X→en→Y): the engine has no direct X→Y path, so both hops rode language packs and round-trip fidelity depends on both. | |
| round_trip | No | Round-trip verification result. Present only when the tool was called with verify_round_trip: true; absent otherwise. | |
| source_lang | Yes | ||
| target_lang | Yes | ||
| python_version | Yes | ||
| translated_source | Yes |