Skip to main content
Glama
cygnussystems

cygnus-ssh-mcp

Official

ssh_file_get_context_around_line

Show the lines before and after a target line in a remote file via SFTP, so you can inspect context before editing. Requires an exact, unique line match.

Instructions

Get lines before and after a line, to see it in context before editing. Like the line-editing tools (ssh_file_replace_line and siblings), match_line must match exactly one line in the file (whitespace-trimmed, literal text, not a pattern) - use ssh_file_find_lines_with_pattern first if you're not sure the line is unique.

Reads the file via SFTP and matches locally (same as ssh_file_find_lines_with_pattern) - Unicode/non-ASCII content is safe on all platforms, including Windows.

Returns: On a unique match: {'match_found': True, 'match_line_number': int, 'context_block': [{'line_number': int, 'content': str}, ...]} (the matched line plus context lines before/after). If the line isn't found, or matches more than once: {'match_found': False, 'error': str} - for a multi-match error, also includes 'matches' (every matching line, so you can pick a more specific match_line).

Long-running calls: if this takes longer than the server's wait cap (default 50s), it
returns {"status": "in_progress", "handle_id": ...} instead of the result - the work keeps
running. Get the result by polling ssh_cmd_check_status(handle_id=...), which returns this
tool's normal response once finished. Do not call it again meanwhile. Only one such
operation runs at a time; another one started meanwhile fails with a 'busy' error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contextNoNumber of lines before and after to include
use_sudoNoUse sudo for the operation
file_pathYesPath to the file
match_lineYesExact line content to match

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.3.0

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it discloses the SFTP read + local matching model, Unicode/non-ASCII safety on all platforms, and the long-running async contract (50s wait cap, in_progress handle_id, poll via ssh_cmd_check_status, single-operation concurrency with a 'busy' failure). This is unusually complete behavioral disclosure.

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?

Front-loaded purpose followed by clearly separated guidance and a Returns block; every section earns its place. It is somewhat long, and the return-shape detail is redundant given the output schema, which keeps it from a 5.

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

Completeness5/5

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

For a 4-param tool with no annotations, the description covers purpose, uniqueness precondition, alternative tool, platform safety, and the async polling contract. Although an output schema exists (so return values needn't be restated), the added detail does no harm and nothing an agent needs to call this correctly is missing.

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 coverage is 100% so the baseline is 3, but the description adds real semantics beyond the schema: match_line is 'whitespace-trimmed, literal text, not a pattern', which is not obvious from the schema's 'Exact line content to match'. context and use_sudo are left to the schema, so it stops short of a 5.

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 ('Get lines before and after a line ... to see it in context before editing') and explicitly positions itself against the line-editing tools it complements. An agent can distinguish it from ssh_file_replace_line and siblings without opening a schema.

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?

Gives explicit when-to-use ('before editing') and a concrete prerequisite path: use ssh_file_find_lines_with_pattern first if the line's uniqueness is uncertain. It also states the hard precondition that match_line must match exactly one line, which routes the agent correctly.

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