Skip to main content
Glama
cygnussystems

cygnus-ssh-mcp

Official

ssh_file_replace_line

Replace a specific line in a remote file with a new line using exact content matching, supporting sudo for privileged files.

Instructions

Replace a unique line in a file with a new line.

PARAMETERS:

  • file_path: Path to the file to modify

  • match_line: Exact line content to match and replace (whitespace-trimmed)

  • new_line: New line to insert in place of the match

  • use_sudo: Use sudo for the operation (default: false)

  • force: Force operation even if file can't be read (sudo only) (default: false)

RETURNS: A dictionary with operation status including:

  • success: Boolean indicating if operation succeeded

  • file_path: Path to the modified file

EXAMPLES: Example 1: Replace a commented line with an active configuration

{
  "file_path": "/etc/ssh/sshd_config",
  "match_line": "#ClientAliveInterval 0",
  "new_line": "ClientAliveInterval 300"
}

Note: To delete a line entirely, use the dedicated ssh_file_delete_line_by_content tool instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to the file to modify
match_lineYesExact line content to match and replace
new_lineYesNew line to insert in place of the match
use_sudoNoUse sudo for the operation
forceNoForce operation even if file can't be read (sudo only)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior3/5

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

No annotations, so description carries full burden. Covers use_sudo and force behaviors, and returns dictionary. Missing details on what happens if line not found or multiple matches, and whether operation is destructive without backup.

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?

Well-structured with sections, clear and mostly concise. Some redundancy in parameter descriptions repeating schema, but overall efficient and front-loaded.

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?

Covers main functionality, parameters, returns, and an example. Output schema reduces burden, but missing error cases and edge behaviors like file not found or non-unique lines.

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?

Input schema has 100% coverage, but description adds value by clarifying 'whitespace-trimmed' for match_line, providing defaults, and including an example. Adds meaning beyond schema.

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 it replaces a unique line in a file, specifying the verb and resource. It differentiates from siblings like ssh_file_delete_line_by_content and implicitly from ssh_file_replace_line_multi by emphasizing 'unique line'.

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?

Provides explicit guidance to use a sibling tool for deletion. Mentions whitespace trimming for match_line. However, lacks explicit context on when to use this tool vs multi-line replacement or prerequisites like file existence.

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/cygnussystems/cygnus-ssh-mcp'

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