Module: PostHog::MCP::Intent Private
- Defined in:
- lib/posthog/mcp/intent.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Resolve $mcp_intent from the agent-supplied context argument (source
context_parameter) or the customer's intent_fallback (source inferred).
Class Method Summary collapse
- .normalize(intent) ⇒ Object private
-
.resolve(data, request, extra, context = nil) ⇒ Array(String, String)?
private
[intent, source]. - .run_fallback(data, request, extra) ⇒ Object private
Class Method Details
.normalize(intent) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 15 16 17 |
# File 'lib/posthog/mcp/intent.rb', line 12 def normalize(intent) return nil unless intent.is_a?(String) trimmed = intent.strip trimmed.empty? ? nil : trimmed end |
.resolve(data, request, extra, context = nil) ⇒ Array(String, String)?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns [intent, source].
23 24 25 26 27 28 29 30 31 |
# File 'lib/posthog/mcp/intent.rb', line 23 def resolve(data, request, extra, context = nil) params = request[:params] || request['params'] || {} name = params[:name] || params['name'] missing_name = Tools.missing_capability_tool_name(data.) intent = normalize(context) return [intent, 'context_parameter'] if data..context_enabled? && name != missing_name && intent run_fallback(data, request, extra) end |
.run_fallback(data, request, extra) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/posthog/mcp/intent.rb', line 33 def run_fallback(data, request, extra) fallback = data..intent_fallback return nil unless fallback intent = normalize(Callbacks.call(fallback, request, extra)) intent ? [intent, 'inferred'] : nil rescue StandardError => e Log.debug(data., "intent_fallback callback error: #{e.message}") nil end |