Class: Tools::GetSupportCaseTool
- Inherits:
-
ApplicationTool
- Object
- MCP::Tool
- ApplicationTool
- Tools::GetSupportCaseTool
- Defined in:
- app/mcp/tools/get_support_case_tool.rb
Overview
MCP Tool for retrieving full details of a single support case.
Returns the case metadata, all participants, recent activities (with notes),
recent communications, linked orders, RMAs, and child cases.
Constant Summary collapse
- RECENT_ACTIVITIES_LIMIT =
25- RECENT_COMMUNICATIONS_LIMIT =
15
Class Method Summary collapse
Class Method Details
.call(case_id: nil, case_number: nil, server_context: nil) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/mcp/tools/get_support_case_tool.rb', line 38 def call(case_id: nil, case_number: nil, server_context: nil) has_id = case_id.present? has_num = case_number.present? return json_response(error: 'Provide exactly one of case_id or case_number') if has_id == has_num sc = if has_id SupportCase.find_by(id: case_id) else normalized = case_number.to_s.strip.upcase SupportCase.where('UPPER(TRIM(case_number)) = ?', normalized).first end return json_response(error: "Support case not found") unless sc json_response(support_case: format_full_case(sc)) end |