refactor-code
Refactor code snippets by applying specific instructions, using optional file context for precision. Supports multiple programming languages to enhance code quality and maintainability.
Instructions
Refactors a given code snippet based on specific instructions, optionally using surrounding file context.
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": {
"language": "<language>",
"codeContent": "<codeContent>",
"refactoringInstructions": "<refactoringInstructions>"
},
"name": "refactor-code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| codeContent | Yes | The actual code snippet to be refactored. | |
| contextFilePath | No | Optional relative path to a file whose content provides broader context for the refactoring task. | |
| language | Yes | The programming language of the code snippet (e.g., 'typescript', 'python', 'javascript') | |
| refactoringInstructions | Yes | Specific instructions on how the code should be refactored (e.g., 'extract the loop into a separate function', 'improve variable names', 'add error handling', 'convert promises to async/await'). |