Skip to main content
Glama

select

Select text lines in a file by specifying start and end positions for editing operations. This tool prepares content for subsequent modifications within the editor-mcp server.

Instructions

Select lines from for subsequent overwrite operation.

Args: start (int): Start line number (1-based) end (int): End line number (1-based)

Returns: dict: status, lines, start, end, id, line_count, message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startYes
endYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'select' MCP tool. It validates the line range, reads the current file, computes a unique ID for the selected content using calculate_id, stores the selection in instance variables, and returns details including the lines, ID, and status for use in subsequent overwrite operations.
    async def select(
        start: int,
        end: int,
    ) -> Dict[str, Any]:
        """
        Select lines from for subsequent overwrite operation.
    
        Args:
            start (int): Start line number (1-based)
            end (int): End line number (1-based)
    
        Returns:
            dict: status, lines, start, end, id, line_count, message
        """
        if self.current_file_path is None:
            return {"error": "No file path is set. Use set_file first."}
    
        try:
            with open(self.current_file_path, "r", encoding="utf-8") as file:
                lines = file.readlines()
    
            if start < 1:
                return {"error": "start must be at least 1."}
    
            if end > len(lines):
                end = len(lines)
    
            if start > end:
                return {"error": "start cannot be greater than end."}
    
            if end - start + 1 > self.max_select_lines:
                return {
                    "error": f"Cannot select more than {self.max_select_lines} lines at once (attempted {end - start + 1} lines)."
                }
    
            selected_lines = lines[start - 1 : end]
            text = "".join(selected_lines)
    
            current_id = calculate_id(text, start, end)
    
            self.selected_start = start
            self.selected_end = end
            self.selected_id = current_id
    
            # Convert selected lines to a list without line numbers
            lines_content = [line.rstrip() for line in selected_lines]
    
            result = {
                "status": "success",
                "lines": lines_content,
                "start": start,
                "end": end,
                "id": current_id,
                "line_count": len(selected_lines),
                "message": f"Selected lines {start} to {end} for editing.",
            }
    
            return result
    
        except Exception as e:
            return {"error": f"Error selecting lines: {str(e)}"}
Behavior2/5

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

With no annotations provided, the description carries full burden but provides minimal behavioral information. It mentions this is for a 'subsequent overwrite operation' which implies this is a preparatory step, but doesn't describe what happens during the selection (does it lock lines? create a temporary buffer? require specific permissions?). No information about side effects, error conditions, or performance characteristics.

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

Conciseness4/5

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

The description is appropriately brief with clear sections (purpose statement, Args, Returns). The first sentence could be more polished ('Select lines from' is incomplete), but overall the structure is efficient with no wasted words. Each section serves a clear purpose.

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

Completeness3/5

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

Given there's an output schema (Returns section), the description doesn't need to explain return values in detail. However, for a tool with no annotations and only 2 parameters, the description provides adequate but minimal context. It explains what the tool does and documents parameters, but lacks information about error conditions, prerequisites, or how it integrates with the 'overwrite' sibling tool.

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 description includes an Args section that clearly documents both parameters with their types and meaning (line numbers, 1-based). With 0% schema description coverage and only 2 parameters, this documentation fully compensates for the schema gap. The parameter information is complete and adds meaningful context beyond the bare schema.

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

Purpose3/5

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

The description states the tool 'Select lines from for subsequent overwrite operation' which indicates a selection function but is grammatically awkward and vague about what resource is being selected from. It distinguishes from siblings like 'overwrite' by indicating this is a preparatory step, but doesn't clarify what type of content or file is involved.

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

Usage Guidelines2/5

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

The description mentions this is 'for subsequent overwrite operation' which provides some context about when to use it, but doesn't explicitly state when NOT to use it or what alternatives exist. No guidance is given about prerequisites or how this tool relates to other file operations in the sibling list.

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