Skip to main content
Glama
sfz009900

Kali Linux MCP Server

by sfz009900

close_interactive_command

Terminate an active interactive command session on the Kali Linux MCP Server by specifying the session ID, ensuring secure and controlled closure of ongoing operations.

Instructions

关闭交互式命令会话。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes交互式会话ID。

Implementation Reference

  • Handler for the close_interactive_command tool. Validates session_id, retrieves the InteractiveSession from activeSessions map, calls session.close(), removes it from the map, and returns success response with final stdout/stderr.
    case "close_interactive_command": {
      const sessionId = String(request.params.arguments?.session_id);
      
      if (!sessionId) {
        throw new McpError(ErrorCode.InvalidParams, "会话ID是必需的");
      }
      
      const session = activeSessions.get(sessionId);
      if (!session) {
        throw new McpError(ErrorCode.InvalidParams, `找不到会话ID: ${sessionId}`);
      }
      
      try {
        log.info(`关闭会话 ${sessionId}`);
        session.close();
        activeSessions.delete(sessionId);
        
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              status: "success",
              message: "会话已关闭",
              final_stdout: session.stdout,
              final_stderr: session.stderr
            })
          }]
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        log.error(`关闭会话失败: ${errorMessage}`);
        throw new McpError(
          ErrorCode.InternalError,
          `无法关闭会话: ${errorMessage}`
        );
      }
    }
  • src/index.ts:140-153 (registration)
    Tool registration in ListTools response, including name, description, and input schema requiring session_id.
    {
      name: "close_interactive_command",
      description: "关闭交互式命令会话。",
      inputSchema: {
        type: "object",
        properties: {
          session_id: {
            type: "string",
            description: "交互式会话ID。"
          }
        },
        required: ["session_id"]
      }
    }
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 action ('close') but doesn't explain what happens upon closing (e.g., whether resources are freed, if the session is terminated permanently, or any side effects). This is a significant gap for a mutation tool with zero annotation coverage.

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 in Chinese ('关闭交互式命令会话。') that directly states the purpose without unnecessary words. It's front-loaded and appropriately sized for the tool's complexity.

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 the tool's complexity (a mutation operation to close sessions), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like effects of closing, error conditions, or return values, making it inadequate for safe and 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?

The input schema has 100% description coverage, with the parameter 'session_id' documented as '交互式会话ID' (interactive session ID). The description doesn't add any meaning beyond this, such as format examples or sourcing details. Baseline 3 is appropriate when the schema does the heavy lifting.

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 '关闭交互式命令会话' (close interactive command session) clearly states the verb ('close') and resource ('interactive command session'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'execute_command' or 'start_interactive_command' beyond the 'close' action, missing specific sibling comparison.

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 session from 'start_interactive_command'), exclusions, or context for choosing it over other command-related tools, leaving 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

Related 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/sfz009900/kalilinuxmcp'

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