Skip to main content
Glama
atengk
by atengk

ssh_forward_port

Create SSH port forwarding tunnels to map a local port to a remote internal service through an existing SSH connection, with idle timeout auto-release to prevent leaks.

Instructions

建立本地端口转发隧道(-L),将宿主机本地端口经由 SSH 链路转发至远程内网服务(内置空闲超时释放防泄漏)

Input Schema

NameRequiredDescriptionDefault
typeNo隧道类型:local (本地正向转发 -L), remote (远程反向转发 -R), socks5 (本地动态代理 -D),默认 locallocal
localHostNo宿主机本地绑定的监听地址,默认 127.0.0.1127.0.0.1
localPortNo宿主机本地监听端口,传 0 或缺省时自动分配空闲随机端口
remoteHostNo远程目标主机地址或内网主机名,默认 127.0.0.1127.0.0.1
remotePortNo远程目标服务端口号(local/remote 模式必填,socks5 模式自动动态解析)
connectionIdNo使用的 SSH 物理连接标识符,缺省时使用当前默认连接
idleTimeoutSecondsNo空闲自动超时释放时间(秒),默认 300 秒无流量自动关闭隧道以防泄漏;传 0 表示长驻不超时

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.4.1

TDQS

B3.3/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose one genuinely useful behavior: a built-in idle timeout that auto-releases the tunnel to prevent leaks. However, it omits other key behaviors such as the SSH-connection prerequisite, failure/auth semantics, and what identifying handle the created tunnel returns.

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?

A single dense sentence that front-loads the action (建立...隧道) and the mechanism (-L), then appends the leak-prevention behavior in parenthesis. No wasted words.

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?

No annotations and no output schema exist, so the description should carry more. It covers the core action and one behavioral trait, but omits prerequisites (existing SSH connection) and what the tool returns (a tunnel identifier usable with ssh_tunnel_list/ssh_tunnel_close), leaving gaps for a 7-parameter tool.

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 every parameter (type, localHost, localPort, remoteHost, remotePort, connectionId, idleTimeoutSeconds) is already explained in the schema. The description adds no parameter-level detail beyond what the schema provides, so the baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a specific verb+resource (建立端口转发隧道) and even names the equivalent SSH flag (-L), so an agent immediately knows this creates a forwarding tunnel. It is somewhat narrowed to local/-L mode even though the schema supports local/remote/socks5, and it does not distinguish itself from the ssh_tunnel_list/ssh_tunnel_close siblings.

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

Usage Guidelines2/5

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

There is no explicit guidance on when to use this tool versus alternatives, nor any stated prerequisites such as needing an existing SSH connection. The relationship to ssh_tunnel_list and ssh_tunnel_close (how to inspect or tear down the tunnel created here) is left entirely to inference.

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