Class: Msf::MCP::Tools::SessionList
- Inherits:
-
MCP::Tool
- Object
- MCP::Tool
- Msf::MCP::Tools::SessionList
- Extended by:
- ToolHelper
- Defined in:
- lib/msf/core/mcp/tools/session_list.rb
Overview
MCP Tool: List Active Sessions
Wraps the ‘session.list` RPC endpoint and returns a hash of active framework sessions keyed by session ID.
Constant Summary
Constants included from ToolHelper
ToolHelper::DANGEROUS_MODE_DISABLED_MESSAGE
Class Method Summary collapse
-
.call(server_context:) ⇒ MCP::Tool::Response
Execute session listing.
Methods included from ToolHelper
dangerous_mode_required!, tool_error_response, with_tool_context
Class Method Details
.call(server_context:) ⇒ MCP::Tool::Response
Execute session listing
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/msf/core/mcp/tools/session_list.rb', line 50 def call(server_context:) with_tool_context(server_context, 'session_list') do |msf_client| raw_result, elapsed = Rex::Stopwatch.elapsed_time do msf_client.session_list || {} end = { query_time: elapsed.round(3), total_sessions: raw_result.size } ::MCP::Tool::Response.new( [{ type: 'text', text: JSON.generate(metadata: , data: raw_result) }], structured_content: { metadata: , data: raw_result } ) end end |