Class: Msf::MCP::Tools::ModuleResults

Inherits:
MCP::Tool
  • Object
show all
Extended by:
ToolHelper
Defined in:
lib/msf/core/mcp/tools/module_results.rb

Overview

MCP Tool: Retrieve Module Run Results

Polls the ‘module.results` RPC endpoint with a UUID returned by ModuleExecute or ModuleCheck and returns the current status.

Constant Summary

Constants included from ToolHelper

ToolHelper::DANGEROUS_MODE_DISABLED_MESSAGE

Class Method Summary collapse

Methods included from ToolHelper

dangerous_mode_required!, tool_error_response, with_tool_context

Class Method Details

.call(uuid:, server_context:) ⇒ MCP::Tool::Response

Execute results lookup

Parameters:

  • uuid (String)

    Module run UUID

  • server_context (Hash)

    Server context with msf_client, rate_limiter

Returns:

  • (MCP::Tool::Response)

    Structured response with run status



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/msf/core/mcp/tools/module_results.rb', line 66

def call(uuid:, server_context:)
  with_tool_context(server_context, 'module_results') do |msf_client|
    Msf::MCP::Security::InputValidator.validate_uuid!(uuid)

    raw_result, elapsed = Rex::Stopwatch.elapsed_time do
      msf_client.module_results(uuid)
    end

    data = raw_result.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

     = { query_time: elapsed.round(3) }

    ::MCP::Tool::Response.new(
      [{ type: 'text', text: JSON.generate(metadata: , data: data) }],
      structured_content: { metadata: , data: data }
    )
  end
end