skim
Extract the first SKIM_MAX_LINES from a file to quickly preview its content. Returns a dictionary including extracted lines, total lines, and max select lines for efficient file navigation.
Instructions
Read text from the current file, truncated to the first SKIM_MAX_LINES lines.
Returns: dict: lines, total_lines, max_select_lines
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/text_editor/server.py:420-452 (handler)The 'skim' tool handler: reads the first up to SKIM_MAX_LINES (default 500) lines of the current file, returns them numbered along with total line count and max_select_lines. Includes truncation hint if applicable.async def skim() -> Dict[str, Any]: """ Read text from the current file, truncated to the first `SKIM_MAX_LINES` lines. Returns: dict: lines, total_lines, max_select_lines """ if self.current_file_path is None: return {"error": "No file path is set. Use set_file first."} with open(self.current_file_path, "r", encoding="utf-8") as file: lines = file.readlines() formatted_lines = [] max_lines_to_show = int(os.getenv("SKIM_MAX_LINES", "500")) lines_to_process = lines[:max_lines_to_show] for i, line in enumerate(lines_to_process, 1): formatted_lines.append((i, line.rstrip())) result = { "lines": formatted_lines, "total_lines": len(lines), "max_select_lines": self.max_select_lines, } # Add hint if file was truncated if len(lines) > max_lines_to_show: result["truncated"] = True result["hint"] = ( f"File has {len(lines)} total lines. Only showing first {max_lines_to_show} lines. Use `read` to view specific line ranges or `find_line` to search for content in the remaining lines." ) return result