Skip to main content
Glama

ssh_docker_status

Check Docker container status in a specified working directory on a remote server via SSH connection.

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 parses input, retrieves SSH connection context, executes 'docker ps -a' and optionally 'docker-compose ps' to check Docker container status, and returns the 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, including name, description, and inputSchema matching the handler.
    {
      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)
    Dispatch case in the CallToolRequest handler switch statement that routes to the 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 for behavioral disclosure. It states 'Check' which implies a read-only operation, but doesn't confirm if it's safe or has side effects. It lacks details on what 'status' includes (e.g., running/stopped containers), error handling, or output format. For a tool with no annotations, 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.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core purpose and includes necessary context ('in working directory'). Every word earns its place, 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 and no output schema, the description is incomplete for a tool that interacts with Docker via SSH. It doesn't explain what 'status' entails, potential errors, or return values. For a tool with 2 parameters and complex context (SSH + Docker), more detail is needed to guide effective use.

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 no parameter-specific information beyond implying that workingDirectory relates to where Docker containers are checked. Since the schema handles the heavy lifting, 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 action ('Check') and resource ('Docker container status'), with the specific context 'in working directory' providing scope. It distinguishes from siblings like ssh_docker_deploy (which deploys rather than checks) and ssh_execute (which runs commands generally). However, it doesn't explicitly differentiate from all siblings, such as ssh_file_info which also inspects status in a directory.

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 SSH connection first), exclusions, or comparisons to siblings like ssh_execute (which could run 'docker ps' manually). The context 'in working directory' implies a location constraint but offers no explicit usage rules.

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

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