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

Output 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
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses key behavioral traits: it's a read operation (implied by 'Read text'), truncates output based on `SKIM_MAX_LINES`, and returns a dict with specific keys. However, it doesn't mention permissions, error conditions, or how `SKIM_MAX_LINES` is defined (e.g., environment variable, default value), leaving some gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is highly concise and well-structured: the first sentence states the core action and constraint, and the second sentence clearly outlines the return format. Every sentence earns its place with no wasted words, making it easy to parse and front-loaded with essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (0 parameters, read-only operation) and the presence of an output schema (implied by 'Returns: dict'), the description is mostly complete. It covers purpose, behavior, and output structure. However, it lacks details on `SKIM_MAX_LINES` (e.g., source or default) and any prerequisites (e.g., needing a file set via 'set_file'), which would enhance completeness for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, focusing instead on behavior and output. A baseline of 4 is applied since no parameters exist, and the description adds value by explaining the tool's operation beyond the empty schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Read text from the current file') and resource ('current file'), distinguishing it from siblings like 'read' (which presumably reads the entire file) by specifying truncation behavior. It explicitly mentions the truncation limit ('first `SKIM_MAX_LINES` lines'), making the scope unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by specifying it reads from 'the current file' (suggesting a file must already be selected/opened) and truncates output, which differentiates it from tools like 'read' (full file reading) or 'select' (line selection). However, it doesn't explicitly state when NOT to use it or name alternatives, missing full sibling differentiation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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