Skip to main content
Glama

skim

Read and display the first lines of the current file to quickly review content without opening the entire document.

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Implementation of the 'skim' tool handler. Reads the first up to 500 lines (configurable via SKIM_MAX_LINES) from the current file set by set_file(), formats as list of [line_number, content], includes total lines and max_select_lines, warns if truncated.
    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

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/danielpodrazka/editor-mcp'

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