Skip to main content
Glama
widjis
by widjis

ssh_docker_status

Check Docker container status on remote servers via SSH connection to monitor running services and troubleshoot issues in specified directories.

Instructions

Check Docker container status in working directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionIdYesSSH connection ID
workingDirectoryNoWorking directory to check (defaults to current)

Implementation Reference

  • The handler function that implements the core logic of the 'ssh_docker_status' tool. It validates input using DockerStatusSchema, retrieves the SSH connection context, executes 'docker ps -a' and optionally 'docker-compose ps' to check container and compose status, and returns the formatted output.
    private async handleDockerStatus(args: unknown) {
      const params = DockerStatusSchema.parse(args);
      
      const context = connectionContexts.get(params.connectionId);
      if (!context) {
        throw new McpError(
          ErrorCode.InvalidParams,
          `Connection ID '${params.connectionId}' not found`
        );
      }
    
      try {
        const workingDir = params.workingDirectory || context.currentWorkingDirectory;
        
        // Get Docker container status
        const psResult = await context.ssh.execCommand('docker ps -a', {
          cwd: workingDir,
        });
        
        // Get Docker Compose status if compose file exists
        let composeStatus = '';
        if (workingDir) {
          const composeResult = await context.ssh.execCommand('docker-compose ps', {
            cwd: workingDir,
          });
          if (composeResult.code === 0) {
            composeStatus = `\n\nDocker Compose Status:\n${composeResult.stdout}`;
          }
        }
        
        return {
          content: [
            {
              type: 'text',
              text: `Docker Status (${workingDir || 'current directory'}):\n\nContainer Status:\n${psResult.stdout}${composeStatus}`,
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to get Docker status: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • Zod schema defining the input parameters for the 'ssh_docker_status' tool: connectionId (required) and optional workingDirectory.
    const DockerStatusSchema = z.object({
      connectionId: z.string().describe('SSH connection ID'),
      workingDirectory: z.string().optional().describe('Working directory to check (defaults to current)')
    });
  • src/index.ts:464-475 (registration)
    Tool registration in the ListTools response, defining name, description, and inputSchema for 'ssh_docker_status'.
    {
      name: 'ssh_docker_status',
      description: 'Check Docker container status in working directory',
      inputSchema: {
        type: 'object',
        properties: {
          connectionId: { type: 'string', description: 'SSH connection ID' },
          workingDirectory: { type: 'string', description: 'Working directory to check (defaults to current)' }
        },
        required: ['connectionId']
      },
    },
  • src/index.ts:519-520 (registration)
    Registration of the tool handler in the CallToolRequestSchema switch statement, mapping 'ssh_docker_status' to handleDockerStatus method.
    case 'ssh_docker_status':
      return await this.handleDockerStatus(args);
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions checking status but doesn't disclose behavioral traits such as what 'status' includes (e.g., running/stopped containers, logs), whether it's read-only (implied by 'check'), error handling, or output format. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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 with zero waste—it directly states the tool's purpose without redundancy. It's appropriately sized for a simple tool and front-loaded with the core action, making it easy to parse quickly.

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

Completeness2/5

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

Given no annotations, no output schema, and a simple input schema, the description is incomplete. It doesn't explain what the tool returns (e.g., container list, status codes), error conditions, or dependencies (e.g., requires Docker installed). For a tool interacting with Docker via SSH, more context is needed to use it effectively.

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 the schema fully documents both parameters (connectionId and workingDirectory). The description adds minimal value beyond the schema by implying the working directory context but doesn't provide additional syntax, format details, or usage examples. Baseline 3 is appropriate as the schema handles parameter 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 action ('Check') and resource ('Docker container status'), specifying the scope ('in working directory'). It distinguishes from siblings like ssh_docker_deploy (deploy vs. check) and ssh_execute (general execution vs. specific Docker check). However, it doesn't explicitly differentiate from all siblings (e.g., ssh_file_info also checks status but for files).

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 minimal guidance, implying usage when needing to check Docker container status in a working directory via SSH. It lacks explicit when-to-use scenarios, prerequisites (e.g., requires an active SSH connection), or alternatives (e.g., vs. ssh_execute for custom Docker commands). No exclusions or comparisons to siblings are mentioned.

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

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