Class: SchwabMCP::Tools::GetAccountNamesTool

Inherits:
MCP::Tool
  • Object
show all
Extended by:
Loggable
Defined in:
lib/schwab_mcp/tools/get_account_names_tool.rb

Class Method Summary collapse

Methods included from Loggable

log_debug, log_error, log_fatal, log_info, log_warn, logger

Class Method Details

.call(topic: nil, server_context:) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/schwab_mcp/tools/get_account_names_tool.rb', line 30

def self.call(topic: nil, server_context:)
   = SchwabRb::AccountHashManager.new.
  acct_names_content = if  && !.empty?
    formatted_names = .map { |name| "- #{name}" }.join("\n")
    "Configured Schwab Account Names:\n\n#{formatted_names}"
  else
    "      No Schwab Account Names Configured\n\n      You need to configure your Schwab account names in the account_names.json file.\n\n      This file should be located in your schwab_home directory (typically ~/.schwab_rb/).\n\n      For detailed setup instructions, please refer to:\n      https://github.com/jwplatta/schwab_rb/blob/main/doc/ACCOUNT_MANAGEMENT.md\n\n      The account_names.json file should map friendly names to your Schwab account hashes.\n    NO_ACCOUNTS\n  end\n\n  MCP::Tool::Response.new([{\n    type: \"text\",\n    text: acct_names_content\n  }])\nend\n"