Class: Hitch::MCP::Internal::ErrorNormalizer

Inherits:
Object
  • Object
show all
Defined in:
app/models/hitch/mcp/internal/error_normalizer.rb

Overview

Reports only a synthetic failure with fixed structural context, then returns the same generic tool error for every non-explicit failure.

Constant Summary collapse

SOURCE =
"hitch.mcp.tool"
PHASE_CATEGORIES =
{
  context: "context_handoff",
  arguments: "argument_normalization",
  authorization: "argument_policy",
  execution: "host_execution",
  result: "result_normalization"
}.freeze

Class Method Summary collapse

Class Method Details

.call(error:, phase:, context:, tool_name:) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'app/models/hitch/mcp/internal/error_normalizer.rb', line 21

def call(error:, phase:, context:, tool_name:)
  unless expected_denial?(error, phase)
    report(error:, phase:, tool_name:)
    log_local_diagnosis(error:, phase:, tool_name:)
  end
  generic_response
rescue StandardError, SystemStackError
  generic_response
end