Skip to main content
Glama

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

NameRequiredDescriptionDefault
session_idYes交互式会话ID。

Input Schema (JSON Schema)

{ "properties": { "session_id": { "description": "交互式会话ID。", "type": "string" } }, "required": [ "session_id" ], "type": "object" }

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"] } }

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