Module: PostHog::MCP::ModelCapture 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.
Model capture (capture_model). MCP does not standardize model identity:
some clients expose it through vendor metadata, others let the agent
self-report through the injected llm_model argument. Client metadata wins;
$mcp_llm_model_source preserves provenance. Both are unverified.
Constant Summary collapse
- PARAM_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'llm_model'- CODEX_TURN_METADATA_KEY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'x-codex-turn-metadata'
Class Method Summary collapse
- .normalize(model) ⇒ Object private
-
.resolve(request, self_reported) ⇒ Array(String, String)?
private
[model, source].
Class Method Details
.normalize(model) ⇒ 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.
57 58 59 60 61 62 |
# File 'lib/posthog/mcp/intent.rb', line 57 def normalize(model) return nil unless model.is_a?(String) trimmed = model.strip trimmed.empty? || trimmed.casecmp('unknown').zero? ? nil : trimmed end |
.resolve(request, self_reported) ⇒ 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 [model, source].
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/posthog/mcp/intent.rb', line 67 def resolve(request, self_reported) params = request[:params] || request['params'] || {} = params[:_meta] || params['_meta'] codex = .is_a?(Hash) ? ([CODEX_TURN_METADATA_KEY] || [CODEX_TURN_METADATA_KEY.to_sym]) : nil if codex.is_a?(Hash) model = normalize(codex['model'] || codex[:model]) return [model, 'client_metadata'] if model end model = normalize(self_reported) model ? [model, 'self_reported'] : nil end |