Skip to main content
Glama
nwnusun-cool

MCP SSH Tools Server

by nwnusun-cool

test_connection

Test SSH server connectivity by verifying connection status and network accessibility for remote server management.

Instructions

测试服务器连接 参数:

  • server_name: 服务器名称

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
server_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:491-531 (handler)
    The main handler function for the 'test_connection' tool. It is decorated with @mcp.tool() which registers it as an MCP tool. The function tests the SSH connection to the specified server by attempting to establish a connection using paramiko and immediately closing it, returning success or error details.
    @mcp.tool()
    def test_connection(server_name: str) -> Dict[str, Any]:
        """
        测试服务器连接
        参数:
        - server_name: 服务器名称
        """
        if server_name not in mcp_manager.server_configs:
            return {
                "success": False,
                "error": f"未找到服务器配置: {server_name}"
            }
        
        config = mcp_manager.server_configs[server_name]
        try:
            client = paramiko.SSHClient()
            client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
            client.connect(
                hostname=config.ssh_ip,
                port=config.ssh_port,
                username=config.ssh_user,
                password=config.ssh_password,
                timeout=10
            )
            client.close()
            return {
                "success": True,
                "server": server_name,
                "ip": config.ssh_ip,
                "port": config.ssh_port,
                "message": "连接测试成功"
            }
        except Exception as e:
            return {
                "success": False,
                "server": server_name,
                "ip": config.ssh_ip,
                "port": config.ssh_port,
                "error": str(e)
            }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool tests server connections but doesn't describe what this entails: whether it performs ping tests, port checks, authentication verification, or returns specific metrics. It doesn't mention error conditions, timeouts, or what constitutes a successful connection test. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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?

The description is appropriately concise with two clear sections: purpose statement and parameter listing. It uses minimal words to convey essential information without unnecessary elaboration. The structure is logical with purpose first followed by parameters. Every sentence serves a clear purpose.

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?

Given the tool has an output schema (which handles return values), the description focuses on purpose and parameters appropriately. However, for a connection testing tool with no annotations, it should provide more behavioral context about what 'testing' entails. The description is minimally complete but lacks depth about the testing methodology or expected outcomes beyond what the output schema will provide.

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?

The description explicitly lists the single parameter 'server_name' with a brief explanation ('服务器名称' - server name). With schema description coverage at 0%, this adds meaningful context beyond the bare schema. However, it doesn't provide format requirements, examples, or constraints for the server_name parameter. The baseline is appropriate given the single parameter and partial documentation.

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 clearly states the tool's purpose as '测试服务器连接' (test server connection), which is a specific verb+resource combination. It distinguishes itself from siblings like 'list_servers' or 'add_server_config' by focusing on connection testing rather than listing or configuration management. However, it doesn't explicitly differentiate from potential alternatives like 'execute' which might also involve server interaction.

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?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of prerequisites, typical use cases, or comparison with sibling tools like 'list_servers' or 'execute'. The agent must infer usage context solely from the tool name and description without explicit direction.

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/nwnusun-cool/mcp-server-ssh-tools'

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