Skip to main content
Glama

ssh_ping

Verify SSH session connectivity by checking if a remote server connection remains active and responsive using session ID validation.

Instructions

Checks if an SSH session is still alive and responsive

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSSH session ID to check

Implementation Reference

  • The handler logic for the ssh_ping tool which checks if the session exists and executes an 'echo pong' command to verify connectivity.
    case 'ssh_ping': {
      const { sessionId } = SessionIdSchema.parse(args);
      const session = sessionManager.getSession(sessionId);
      if (!session) {
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({ alive: false, error: 'Session not found or expired' }, null, 2)
          }]
        };
      }
    
      try {
        const startTime = Date.now();
        const pingResult = await session.ssh.execCommand('echo pong');
        const latencyMs = Date.now() - startTime;
    
        const result = {
          alive: pingResult.code === 0,
          latencyMs,
          sessionId,
          host: session.info.host,
          remainingMs: Math.max(0, session.info.expiresAt - Date.now())
        };
        logger.info('Session ping', { sessionId, alive: result.alive, latencyMs });
        return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
      } catch (error) {
        return {
          content: [{
            type: 'text',
  • Validation schema for the sessionId input parameter used by ssh_ping and other tools.
    export const SessionIdSchema = z.object({
      sessionId: z.string().min(1)
    });
  • src/mcp.ts:347-356 (registration)
    Tool registration for ssh_ping within the MCP tool list.
      name: 'ssh_ping',
      description: 'Checks if an SSH session is still alive and responsive',
      inputSchema: {
        type: 'object',
        properties: {
          sessionId: { type: 'string', description: 'SSH session ID to check' }
        },
        required: ['sessionId']
      }
    },
Behavior2/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 states the tool checks session liveness and responsiveness, which implies a read-only, non-destructive operation, but doesn't specify what 'responsive' means (e.g., timeout behavior, error handling) or any side effects. For a tool with zero annotation coverage, this is insufficient detail.

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?

The description is a single, efficient sentence that directly states the tool's purpose without redundancy. It is front-loaded and wastes no words, making it easy to parse quickly.

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's low complexity (one parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on behavior, usage context, or output format. With no annotations or output schema, more completeness would be beneficial, but it meets a bare minimum for such a simple 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?

The input schema has 100% description coverage, with the single parameter 'sessionId' clearly documented. The description adds no additional semantic context beyond what the schema provides, such as format examples or validation rules. Given the high schema coverage, the baseline score of 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 clearly states the tool's purpose: 'Checks if an SSH session is still alive and responsive.' It specifies the verb ('checks') and resource ('SSH session'), making the intent unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'ssh_list_sessions' or 'ssh_close_session', which prevents a score of 5.

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. It doesn't mention prerequisites (e.g., needing an active SSH session), exclusions, or related tools like 'ssh_list_sessions' for session IDs or 'ssh_close_session' for termination. This lack of context leaves usage unclear.

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/oaslananka/mcp-ssh-tool'

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