Skip to main content
Glama
lin2000wl
by lin2000wl

delete_lines

Remove specific lines from files after verifying them with read_file to ensure accurate file modifications.

Instructions

Deletes the given lines in the file. Requires that the same range of lines was previously read using the read_file tool to verify correctness of the operation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
relative_pathYesThe relative path to the file.
start_lineYesThe 0-based index of the first line to be deleted.
end_lineYesThe 0-based index of the last line to be deleted.

Implementation Reference

  • The main handler function for the 'delete_lines' tool in the SymbolManager class. It deletes the specified range of lines (0-based indexing, inclusive) from the given relative file path by wrapping the language server's delete operation in a file editing context manager.
    def delete_lines(self, relative_path: str, start_line: int, end_line: int) -> None: """ Deletes lines in the given file. :param start_line: the 0-based index of the first line to delete (inclusive) :param end_line: the 0-based index of the last line to delete (inclusive) """ start_col = 0 end_line_for_delete = end_line + 1 end_col = 0 with self._edited_file(relative_path): start_pos = Position(line=start_line, character=start_col) end_pos = Position(line=end_line_for_delete, character=end_col) self._lang_server.delete_text_between_positions(relative_path, start_pos, end_pos)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lin2000wl/Serena-cursor-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server