Tcl Refactor
Steps
- Read the file.
- Call
mcp__tcl-lsp__refactorwith the contents assourceand the
selection (start_line, start_character, end_line, end_character)
covering the code of interest. On a tool error report it.
- Apply the refactoring the user asked for; otherwise list the available
ones and ask which.
- Apply each edit with Edit and say in a sentence why it is safe and what
it gains.
- Re-validate with
mcp__tcl-lsp__analyze; revert any refactoring that
introduced an issue and say why.
Refactorings
- Extract variable: expression → named variable
- Inline variable: single-use
set var value→ substituted at the use site - if/elseif → switch: chain of
$var eq "literal"tests →switch -exact - switch → dict: arms that set one variable →
dict create+dict get - Brace expr:
expr "$a + $b"→expr {$a + $b}
$ARGUMENTS