Class: DebugMcp::Tools::ListFiles

Inherits:
MCP::Tool
  • Object
show all
Defined in:
lib/debug_mcp/tools/list_files.rb

Constant Summary collapse

MAX_ENTRIES =
500

Class Method Summary collapse

Class Method Details

.call(path:, pattern: nil, session_id: nil, server_context:) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/debug_mcp/tools/list_files.rb', line 42

def call(path:, pattern: nil, session_id: nil, server_context:)
  client = get_client(server_context, session_id)

  if client&.remote
    return list_remote(client, path, pattern)
  end

  full_path = resolve_path(path, server_context, session_id)
  list_local(full_path, pattern)
rescue DebugMcp::Error => e
  MCP::Tool::Response.new([{ type: "text", text: "Error: #{e.message}" }])
end