Skip to main content
Glama
davidfstr
by davidfstr

move_string_in_file

Move a continuous range of lines within a file or between files by specifying cut and paste boundaries using substring matching and an optional marker.

Instructions

Moves a continuous range of lines from one location to another within a file (or between files).

Specify cut boundaries and paste location using substring matching with an optional ⬥ marker.

Example 1: Move a definition before another definition: cutStartAt: "class MyClass:" (start at this line) cutEndAt: "class NextClass:" (end BEFORE this line) pasteAt: "\n⬥def target_function():" (paste adjacent to the \n)

Example 2: Move a paragraph after another paragraph: cutStartAt: "# Close the database" (start at this line) cutEndAt: "db.close()\n⬥" (end after the final paragraph line) pasteAt: "db.open()\n⬥" (paste after a different paragraph's last line)

⬥ in cut boundaries anywhere in a line marks the line to cut when the cut context contains multiple lines. No ⬥ is needed if cut context is within a single line only.

⬥ in a paste boundary must be adjacent to a \n or the start/end of the file. All lines will be pasted before/after the nearby \n or file boundary.

Whitespace at the end of lines is ignored when matching substrings.

After editing reports on blank lines around the cut and paste boundaries, simplifying clean up of nearby line spacing with small subsequent edits.

Does not alter indentation. Use indent_dedent to adjust indentation after moving if needed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cutFilePathYes
cutStartAtYes
cutEndAtYes
pasteAtYes
pasteFilePathNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It explains that whitespace is ignored when matching, that indentation is not altered, and that the tool reports on blank lines after editing. It also describes the marker system for specifying cut/paste boundaries. However, it does not explicitly state that the operation modifies the file destructively (cutting lines), which could be implied but not clearly stated.

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

Conciseness3/5

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

The description is verbose and includes two long examples, which are helpful but detract from conciseness. The marker explanation is repeated twice. The front-loading is acceptable, but the description could be shorter while retaining clarity.

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 complexity (5 parameters, 0% schema coverage, no annotations, but has output schema), the description is fairly complete. It covers the marker system, paste positioning relative to newlines, and edge cases (single line vs. multi-line cut). It mentions the post-editing blank line report. However, details about the return value or error handling are absent.

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?

Schema description coverage is 0%, so the description must add meaning beyond the schema. It explains cutStartAt, cutEndAt, and pasteAt via examples, including the use of the ⬥ marker for multi-line contexts. It also mentions the optional pasteFilePath for moving between files. The description provides significant context that the schema alone does not convey.

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 that the tool moves a continuous range of lines from one location to another within a file or between files. It distinguishes itself from sibling tools like indent_dedent (indentation) and rename_symbol (renaming) by specifying its unique operation—cutting and pasting lines based on substring matching.

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 provides two detailed examples illustrating typical use cases (moving a definition before another, moving a paragraph). It also advises to use indent_dedent for indentation adjustments after moving, giving clear guidance on when to use this tool versus alternatives. However, it does not explicitly state when not to use the tool.

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/davidfstr/revise-mcp'

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