Skip to main content
Glama

delete_lines

Remove specific line ranges from files in Godot projects to clean up code or remove unwanted sections by specifying start and end positions.

Instructions

Delete a range of lines from a file. Line numbers are 1-based.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the file
startYesFirst line to delete (1-based)
endYesLast line to delete (1-based, inclusive)

Implementation Reference

  • The implementation of the delete_lines tool, which reads a file, splits its content into lines, uses splice to remove the specified range, writes the updated content back, and emits a change event.
      name: "delete_lines",
      description: "Delete a range of lines from a file. Line numbers are 1-based.",
      schema: {
        path: z.string().describe("Path to the file"),
        start: z.number().int().min(1).describe("First line to delete (1-based)"),
        end: z.number().int().min(1).describe("Last line to delete (1-based, inclusive)"),
      },
      handler: async (ctx) => {
        const { path, start, end } = ctx.args;
        validatePath(path);
        try {
          const content = readFileSync(path, "utf-8");
          const lines = content.split("\n");
    
          if (start < 1 || end > lines.length || start > end) {
            return makeTextResponse({
              error: `Invalid line range: ${start}-${end} (file has ${lines.length} lines)`,
              data: null,
            });
          }
    
          const deleted = lines.splice(start - 1, end - start + 1);
          writeFileSync(path, lines.join("\n"), "utf-8");
    
          await eventBus.emit("file:changed", {
            path,
            type: "modified",
          });
    
          return makeTextResponse({
            data: { deletedLines: deleted.length, path },
            metadata: { source: "fallback" },
          });
        } catch (err) {
          return makeTextResponse({
            error: `Failed to delete lines: ${(err as Error).message}`,
            data: null,
          });
        }
      },
    },
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 only states the action and line numbering. It misses critical behavioral details: whether deletion is permanent or reversible, permission requirements, error handling (e.g., invalid line ranges), side effects on file structure, or rate limits. This is inadequate for a destructive operation with zero annotation coverage.

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 extremely concise—two brief sentences with zero wasted words. It is front-loaded with the core purpose ('Delete a range of lines from a file') followed by a critical clarification ('Line numbers are 1-based'), making it efficient and easy to parse without unnecessary elaboration.

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

Completeness2/5

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

For a destructive tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits (e.g., permanence, errors), output format (e.g., success confirmation or modified content), and usage context compared to siblings. The high schema coverage helps parameters, but overall guidance is insufficient for safe and effective use.

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

Parameters3/5

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

Schema description coverage is 100%, with clear parameter documentation in the schema. The description adds minimal value by clarifying 'Line numbers are 1-based', which is partially redundant with schema details (e.g., 'minimum': 1). It does not explain parameter interactions (e.g., 'start' must be ≤ 'end') or edge cases beyond what the schema provides, meeting the baseline for high schema coverage.

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 specific action ('Delete a range of lines') and target resource ('from a file'), with precise scope ('Line numbers are 1-based'). It distinguishes from sibling tools like 'remove_node', 'replace_content', or 'insert_at_line' by focusing on line deletion rather than node operations, content replacement, or insertion.

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?

No guidance is provided on when to use this tool versus alternatives like 'replace_content' for partial modifications or 'create_file' for starting fresh. The description lacks context about prerequisites (e.g., file must exist) or exclusions (e.g., not for binary files), offering only basic operational details without comparative advice.

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/woohq/godette-mcp'

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