Skip to main content
Glama

insert_text

Insert or replace text at specific line ranges in files for precise code editing without context-heavy operations.

Instructions

Insert or replace text at precise line ranges in files

  • Ideal for direct line-number operations (from code citations like 12:15:file.ts) and large files where context-heavy editing is inefficient.

  • TIP: Combine with read_symbol (must use optimize: false!) to edit any symbol anywhere without knowing its file or line range!

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to the file
from_lineYesStarting line number (1-based)
textYesText to insert
to_lineNoReplace up to this line number (1-based, inclusive). If omitted only inserts
Behavior4/5

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

Annotations indicate this is a write operation (readOnlyHint: false) and not open-world (openWorldHint: false), which the description aligns with by describing text insertion/replacement. The description adds valuable context about efficiency for large files and the need to combine with 'read_symbol' for symbol editing, going beyond what annotations provide.

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 front-loaded with the core purpose in the first sentence, followed by specific usage scenarios and a tip. Every sentence adds value without redundancy, making it efficient and well-structured for quick understanding.

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?

For a mutation tool with no output schema, the description provides good contextual completeness by explaining use cases, efficiency considerations, and integration with sibling tools. It could be slightly improved by mentioning error handling or confirmation of changes, but it covers the essential context given the annotations and schema richness.

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%, so the schema fully documents all parameters. The description does not add any parameter-specific details beyond what's in the schema, such as explaining the relationship between 'from_line' and 'to_line' or providing examples. Baseline 3 is appropriate when schema coverage is complete.

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 ('Insert or replace text') on a specific resource ('at precise line ranges in files'), distinguishing it from sibling tools like 'os_notification' and 'read_symbol' which serve different purposes. It explicitly mentions the target use case for line-number operations.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool ('Ideal for direct line-number operations... and large files where context-heavy editing is inefficient') and when to combine it with alternatives ('Combine with read_symbol... to edit any symbol anywhere without knowing its file or line range'), including a specific tip about using 'optimize: false'.

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/OrionPotter/flesler-mcp-tools'

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