Get Code Fixes
getCodeFixesRetrieve available code fixes for specific error codes at a defined range in a TypeScript or JavaScript file. Uses diagnostic error codes and range to return tsserver's suggested code actions.
Instructions
Get available code fixes for specific error codes at a range in a TypeScript/JavaScript file. Returns the raw list of code actions tsserver suggests for the given diagnostics. Use getDiagnostics first to discover error codes and ranges, then pass them here.
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": {
"file": "<file>",
"startLine": "<startLine>",
"startOffset": "<startOffset>",
"endLine": "<endLine>",
"endOffset": "<endOffset>",
"errorCodes": "<errorCodes>"
},
"name": "getCodeFixes"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | File path (absolute or relative to cwd) | |
| endLine | Yes | 1-based end line | |
| endOffset | Yes | 1-based end character offset | |
| startLine | Yes | 1-based start line | |
| errorCodes | Yes | Diagnostic error codes to get fixes for | |
| startOffset | Yes | 1-based start character offset |