Class: GetProductsTool

Inherits:
MCP::Tool
  • Object
show all
Defined in:
lib/get_products_tool.rb

Overview

Tool to retrieve all products from Firestore.

Class Method Summary collapse

Class Method Details

.call ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/get_products_tool.rb', line 14

def call(*)
  client = FirestoreClient.instance
  return db_not_running_response unless client.db_running

  products = format_products(client.products)
  MCP::Tool::Response.new([{ type: 'text', text: products.to_json }])
rescue StandardError => e
  error_response(e)
end