Skip to main content
Glama
gunjanjp

Linux Bash MCP Server

by gunjanjp

check_wsl_status

Check WSL2 status and retrieve distribution details to verify Windows Subsystem for Linux functionality and configuration.

Instructions

Check WSL2 status and get distribution information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that implements the check_wsl_status tool. It checks WSL status using 'wsl -l -v', tests connection to the distribution, retrieves OS info from /etc/os-release, and returns a JSON-formatted response with status details.
    async checkWSLStatus() {
      try {
        // Check WSL status
        const { stdout: wslList } = await execAsync("wsl -l -v");
        
        // Try to execute a simple command in the selected distribution
        let testOutput = "Not tested";
        let osInfo = "Not available";
        
        if (this.wslDistribution) {
          try {
            const { stdout: testResult } = await execAsync(`wsl -d ${this.wslDistribution} -- echo 'WSL connection test successful'`);
            testOutput = testResult.trim();
          } catch (error) {
            testOutput = `Test failed: ${error.message}`;
          }
    
          // Get distribution-specific information
          try {
            const { stdout: osResult } = await execAsync(`wsl -d ${this.wslDistribution} -- cat /etc/os-release`);
            osInfo = osResult.trim();
          } catch (error) {
            osInfo = `OS info not available: ${error.message}`;
          }
        }
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                success: true,
                wslStatus: "Running",
                selectedDistribution: this.wslDistribution || "Not configured",
                allDistributions: wslList.trim(),
                testOutput: testOutput,
                osInfo: osInfo,
                serverConfig: {
                  configuredDistribution: this.config?.wslDistribution,
                  defaultTimeout: this.config?.defaultTimeout,
                  scriptTimeout: this.config?.scriptTimeout,
                  debugMode: this.config?.debugMode
                },
                timestamp: new Date().toISOString()
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                success: false,
                wslStatus: "Error",
                selectedDistribution: this.wslDistribution || "Not configured",
                error: error.message,
                timestamp: new Date().toISOString()
              }, null, 2),
            },
          ],
        };
      }
    }
  • The input schema for the check_wsl_status tool, which requires no parameters (empty properties).
    inputSchema: {
      type: "object",
      properties: {},
    },
  • src/index.js:264-293 (registration)
    Registration of the check_wsl_status tool in the ListTools handler (lines 264-271) and dispatch in the CallToolRequestSchema switch case (lines 292-293), including description and schema.
          {
            name: "check_wsl_status",
            description: "Check WSL2 status and get distribution information",
            inputSchema: {
              type: "object",
              properties: {},
            },
          }
        ],
      };
    });
    
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
      console.error(`[DEBUG] Tool request: ${name}`, args);
    
      try {
        switch (name) {
          case "execute_bash_command":
            return await this.executeBashCommand(args);
          case "execute_bash_script":
            return await this.executeBashScript(args);
          case "create_bash_script":
            return await this.createBashScript(args);
          case "list_directory":
            return await this.listDirectory(args);
          case "get_system_info":
            return await this.getSystemInfo();
          case "check_wsl_status":
            return await this.checkWSLStatus();
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 what the tool does but doesn't describe what information is returned, format of output, whether it requires WSL2 installation, error conditions, or performance characteristics. 'Check' implies a read operation, but this isn't explicitly stated.

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 communicates the core purpose without any wasted words. It's appropriately sized for a zero-parameter status-checking tool and front-loads the essential information.

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?

For a zero-parameter tool with no output schema, the description adequately states what the tool does but lacks details about return format, error handling, or system requirements. Given the simplicity of the tool (no parameters, no complex schema), the description is minimally complete but could benefit from more behavioral context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters with 100% schema description coverage, so the baseline is 4. The description appropriately doesn't discuss parameters since none exist, which is correct for this schema.

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 with a specific verb ('check') and resource ('WSL2 status and distribution information'). It distinguishes itself from siblings like 'get_system_info' by focusing specifically on WSL2, but doesn't explicitly contrast with them in the description text.

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 like 'get_system_info' (which might include WSL info) or when WSL2 status checking is appropriate. There's no mention of prerequisites, timing, or context for usage.

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/gunjanjp/linuxshell-mcp'

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