Class: GetProductByIdTool
- Inherits:
-
MCP::Tool
- Object
- MCP::Tool
- GetProductByIdTool
- Defined in:
- lib/get_product_by_id_tool.rb
Overview
Tool to retrieve a specific product by its ID from Firestore.
Class Method Summary collapse
Class Method Details
.call(id:) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/get_product_by_id_tool.rb', line 23 def call(id:) client = FirestoreClient.instance return db_not_running_response unless client.db_running product = client.product_by_id(id) return product_not_found_response if product.nil? MCP::Tool::Response.new([{ type: 'text', text: JSON.pretty_generate(product) }]) end |