Class: PostHog::MCP::Options
- Inherits:
-
Object
- Object
- PostHog::MCP::Options
- Defined in:
- lib/posthog/mcp/options.rb
Overview
Experimental: option names may change in a future minor release.
Configuration for instrument.
Instance Attribute Summary collapse
-
#before_send ⇒ #call?
readonly
(payload) -> payload | nil; runs once per emitted payload, nil drops it. -
#capture_model ⇒ Boolean, ModelOptions
readonly
Capture
$mcp_llm_model. -
#context ⇒ Boolean, ContextOptions
readonly
Inject the required
contextargument. -
#enable_conversation_id ⇒ Boolean
readonly
Inject
conversation_idand anchor$session_idon it. -
#enable_exception_autocapture ⇒ Boolean
readonly
Emit a sibling
$exceptionevent for failed calls. -
#event_properties ⇒ #call?
readonly
(request, extra) -> Hash | nil, spread flat onto every auto-captured event. -
#identify ⇒ #call, ...
readonly
(request, extra) -> UserIdentity | Hash | nil, or a static identity. -
#intent_fallback ⇒ #call?
readonly
(request, extra) -> String | nil, consulted when nocontextarg was passed. -
#logger ⇒ #call?
readonly
STDIO-safe log sink receiving single String messages.
-
#missing_capability_tool_name ⇒ String
readonly
Name of the virtual tool.
-
#report_missing ⇒ Boolean
readonly
Register the
get_more_toolsvirtual tool.
Instance Method Summary collapse
- #capture_model_enabled? ⇒ Boolean
- #context_description ⇒ String?
- #context_enabled? ⇒ Boolean
-
#initialize(logger: nil, report_missing: false, missing_capability_tool_name: nil, enable_conversation_id: true, enable_exception_autocapture: true, context: true, capture_model: true, identify: nil, intent_fallback: nil, before_send: nil, event_properties: nil) ⇒ Options
constructor
A new instance of Options.
- #model_description ⇒ String?
Constructor Details
#initialize(logger: nil, report_missing: false, missing_capability_tool_name: nil, enable_conversation_id: true, enable_exception_autocapture: true, context: true, capture_model: true, identify: nil, intent_fallback: nil, before_send: nil, event_properties: nil) ⇒ Options
Returns a new instance of Options.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/posthog/mcp/options.rb', line 72 def initialize(logger: nil, report_missing: false, missing_capability_tool_name: nil, enable_conversation_id: true, enable_exception_autocapture: true, context: true, capture_model: true, identify: nil, intent_fallback: nil, before_send: nil, event_properties: nil) @logger = logger @report_missing = report_missing == true @missing_capability_tool_name = missing_capability_tool_name @enable_conversation_id = enable_conversation_id == true @enable_exception_autocapture = enable_exception_autocapture != false @context = normalize_context(context) @capture_model = normalize_model(capture_model) @identify = identify @intent_fallback = intent_fallback @before_send = before_send @event_properties = event_properties end |
Instance Attribute Details
#before_send ⇒ #call? (readonly)
Returns (payload) -> payload | nil; runs once per emitted payload, nil drops it.
68 69 70 |
# File 'lib/posthog/mcp/options.rb', line 68 def before_send @before_send end |
#capture_model ⇒ Boolean, ModelOptions (readonly)
Returns Capture $mcp_llm_model. Default true.
62 63 64 |
# File 'lib/posthog/mcp/options.rb', line 62 def capture_model @capture_model end |
#context ⇒ Boolean, ContextOptions (readonly)
Returns Inject the required context argument. Default true.
60 61 62 |
# File 'lib/posthog/mcp/options.rb', line 60 def context @context end |
#enable_conversation_id ⇒ Boolean (readonly)
Returns Inject conversation_id and anchor $session_id on it. Default true.
56 57 58 |
# File 'lib/posthog/mcp/options.rb', line 56 def enable_conversation_id @enable_conversation_id end |
#enable_exception_autocapture ⇒ Boolean (readonly)
Returns Emit a sibling $exception event for failed calls. Default true.
58 59 60 |
# File 'lib/posthog/mcp/options.rb', line 58 def enable_exception_autocapture @enable_exception_autocapture end |
#event_properties ⇒ #call? (readonly)
Returns (request, extra) -> Hash | nil, spread flat onto every auto-captured event.
70 71 72 |
# File 'lib/posthog/mcp/options.rb', line 70 def event_properties @event_properties end |
#identify ⇒ #call, ... (readonly)
Returns (request, extra) -> UserIdentity | Hash | nil, or a static identity.
64 65 66 |
# File 'lib/posthog/mcp/options.rb', line 64 def identify @identify end |
#intent_fallback ⇒ #call? (readonly)
Returns (request, extra) -> String | nil, consulted when no context arg was passed.
66 67 68 |
# File 'lib/posthog/mcp/options.rb', line 66 def intent_fallback @intent_fallback end |
#logger ⇒ #call? (readonly)
Returns STDIO-safe log sink receiving single String messages. Default: no-op.
50 51 52 |
# File 'lib/posthog/mcp/options.rb', line 50 def logger @logger end |
#missing_capability_tool_name ⇒ String (readonly)
Returns Name of the virtual tool. Default get_more_tools.
54 55 56 |
# File 'lib/posthog/mcp/options.rb', line 54 def missing_capability_tool_name @missing_capability_tool_name end |
#report_missing ⇒ Boolean (readonly)
Returns Register the get_more_tools virtual tool. Default false.
52 53 54 |
# File 'lib/posthog/mcp/options.rb', line 52 def report_missing @report_missing end |
Instance Method Details
#capture_model_enabled? ⇒ Boolean
100 101 102 |
# File 'lib/posthog/mcp/options.rb', line 100 def capture_model_enabled? @capture_model != false end |
#context_description ⇒ String?
95 96 97 |
# File 'lib/posthog/mcp/options.rb', line 95 def context_description @context.is_a?(ContextOptions) ? @context.description : nil end |
#context_enabled? ⇒ Boolean
90 91 92 |
# File 'lib/posthog/mcp/options.rb', line 90 def context_enabled? @context != false end |
#model_description ⇒ String?
105 106 107 |
# File 'lib/posthog/mcp/options.rb', line 105 def model_description @capture_model.is_a?(ModelOptions) ? @capture_model.description : nil end |