Skip to main content
Glama
sangingeum
by sangingeum

file_insert_lines

Insert text at a chosen line position without replacing existing content, with dry-run previews and undoable writes.

Instructions

Insert text at a defined position and return operation_id and undo_available.

    line is a 1-based line number. position is before or after that line, or
    end to append at end of file, which takes no line number; there is no
    sentinel line number for end of file. Additive: no existing line is
    replaced. dry_run returns a unified diff preview and writes nothing.
    Otherwise the operation is recorded and undoable.
    

Input Schema

NameRequiredDescriptionDefault
lineNo
pathYes
contentYes
dry_runNo
positionNoafter
expected_hashNo
expected_contentNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.8

TDQS

A4.2/5.0
Behavior5/5

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

Goes well beyond the annotations: dry_run writes nothing and returns a unified diff preview, whereas a real call is recorded and undoable, and the response includes operation_id and undo_available. This explains the mutation's reversibility and failure-free preview path, which annotations alone (destructiveHint=false, idempotentHint=false) do not convey.

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 return contract is front-loaded and every sentence carries operational meaning, including the defensive note about the absent EOF sentinel. Slightly verbose in its line-wrapped phrasing but nothing is redundant.

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?

For a 7-parameter mutation with no output schema, the description adequately covers the return values (operation_id, undo_available) and preview behavior. It falls short on expected_hash/expected_content, so an agent cannot know how to use the optimistic-concurrency guards without guessing.

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?

With 0% schema description coverage, the description carries the full burden, and it documents line (1-based), position (before/after/end), and dry_run semantics well. However, expected_hash and expected_content — the concurrency/consistency guards — are never mentioned, leaving two behaviorally significant parameters completely opaque.

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?

States a specific verb and resource ('Insert text') plus the scope of the operation (at a defined position) and explicitly contrasts it with replacement tools via 'Additive: no existing line is replaced.' An agent can distinguish this from file_replace_lines/file_delete_lines without opening any schema.

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?

Explains the line/position mechanics concretely, including the special 'end' case and the warning that no sentinel line number exists for EOF, plus when dry_run applies. It does not explicitly name a sibling alternative ('use file_replace_lines when...'), but the additive-versus-replace distinction effectively routes the agent.

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