roslyn:apply_code_action_by_title
Apply a Roslyn code action by its exact or partial title. First retrieve available actions at a zero-based position, then use this tool to preview or finalize the change to your source file.
Instructions
Apply a code action by its title. Supports exact and partial matching.
USAGE: apply_code_action_by_title(filePath, line, column, title) OUTPUT: Changed files with preview or applied changes WORKFLOW: (1) Call get_code_actions_at_position first, (2) Apply with preview=true, (3) Apply with preview=false IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1).
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": {
"filePath": "<filePath>",
"line": "<line>",
"column": "<column>",
"title": "<title>"
},
"name": "roslyn:apply_code_action_by_title"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | Yes | Zero-based line number | |
| title | Yes | Action title (exact or partial match) | |
| column | Yes | Zero-based column number | |
| endLine | No | Optional: end line for selection | |
| preview | No | Preview mode (default: true). Set to false to apply. | |
| filePath | Yes | Absolute path to source file | |
| endColumn | No | Optional: end column for selection |