Optimize Source Code
generate-code-optimizationUse this when the user supplies source code and asks for an optimized or refactored version. After authorization, this state-changing action consumes AI credits, creates a generation, and returns the revised code.
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_code": "<source_code>",
"filename": "<filename>"
},
"name": "generate-code-optimization"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Optional custom name used to identify the optimized code in generation history | |
| filename | Yes | The full file path of the file being optimized (e.g., src/utils/helper.ts) | |
| source_code | Yes | The source code to optimize | |
| optimization_focus | No | Focus area for optimization (default: Performance) | |
| additional_instructions | No | Additional instructions for code optimization |