modernize_legacy_code
Convert legacy code snippets to modern production code: CommonJS to ESM, classes to hooks, var to const, callbacks to async/await, and JavaScript to TypeScript.
Instructions
Transforms legacy code snippets into modern production code (CommonJS require -> ESM imports, Class components -> React Hooks, var -> const/let, callbacks -> async/await, JavaScript -> TypeScript).
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": {
"code_snippet": "<code_snippet>",
"target_language": "<target_language>"
},
"name": "modernize_legacy_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code_snippet | Yes | The legacy code snippet to modernize | |
| target_language | Yes | Target modernization stack |