Skip to content

feat(mcp): opt-in captureModel — agent-self-reported model id on MCP events - #4633

Open
DanielVisca wants to merge 3 commits into
mainfrom
posthog/mcp-capture-model
Open

feat(mcp): opt-in captureModel — agent-self-reported model id on MCP events#4633
DanielVisca wants to merge 3 commits into
mainfrom
posthog/mcp-capture-model

Conversation

@DanielVisca

Copy link
Copy Markdown
Contributor

Problem

MCP server owners want to know which LLM is driving their server so they can tell whether tool-call quality degrades on specific models (raised by a customer via the MCP analytics team). The MCP wire deliberately carries no model identity — we validated with a raw-logging MCP server that traffic from the same client is byte-identical across model and effort settings, and no spec revision (through 2026-07-28) changes that. The one place the information exists is the agent itself: harnesses inject the model id into the agent's system prompt, and in testing agents restated it exactly (5/5 exact matches, including full dated model ids) via an injected tool parameter.

Changes

Adds an opt-in captureModel option to @posthog/mcp, reusing the context$mcp_intent injection machinery:

  • Injects a required llm_model string parameter into every tool at tools/list; strips it before the handler runs.
  • Captures it as $mcp_llm_model with $mcp_llm_model_source = "self_reported" — honestly labeled as unverified, matching how the MCP spec treats clientInfo.
  • Ownership-safe: a tool that already declares llm_model keeps it — never stolen, never captured.
  • An honest "unknown" from the agent is dropped rather than recorded; value is truncated like other metadata fields.
  • Reasoning effort is deliberately not collected: it never crosses the wire and agents can't reliably self-report it (validated — the guess was wrong under a forced effort setting), so it would only be noise.

Release info Sub-libraries affected

Libraries affected

  • @posthog/mcp

Checklist

  • Tests for new code
  • Accounted for the impact of any changes across different platforms
  • Accounted for backwards compatibility of any changes (no breaking changes!)
  • Took care not to unnecessarily increase the bundle size

If releasing new changes

  • Changeset file included (.changeset/model-capture-option.md)

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

  • Authored with Claude (PostHog Desktop task). TDD: tests written and confirmed red before implementation; all 665 unit tests, eslint, and tsc pass.
  • Validated the design empirically before writing code: a raw-logging HTTP MCP server + real Claude Code client confirmed no model/effort on the wire, and that an injected self-report parameter returns exact model ids; production $mcp_intent fill rates across major harnesses support cross-harness viability of injected parameters.
  • Chose opt-in (unlike context, which is on by default) because the parameter adds tokens to every tool call and the value is self-reported.

Created with PostHog Desktop

…el id

Injects a required `llm_model` parameter into every tool (mirroring the
`context` -> `$mcp_intent` mechanism) so the calling agent self-reports the
model it runs as, captured as `$mcp_llm_model` with
`$mcp_llm_model_source = "self_reported"`.

The MCP wire deliberately carries no model identity, so agent self-report is
the only capture path: harnesses inject the model id into the agent's system
prompt, and agents restate it accurately. Reasoning effort is intentionally
not collected - agents don't reliably know it.

- Off by default; `captureModel: true` or `{ description }` to enable
- Argument is stripped before the tool handler runs
- A customer-declared `llm_model` parameter is never stolen or captured
- An honest "unknown" from the agent is dropped rather than recorded

Generated-By: PostHog Desktop
Task-Id: efe2cfaa-b580-4392-bdb4-a18eb2cd325b
@DanielVisca
DanielVisca marked this pull request as ready for review August 24, 2026 22:29
@DanielVisca
DanielVisca requested review from a team as code owners August 24, 2026 22:29
@greptile-apps

greptile-apps Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "feat(mcp): add opt-in captureModel optio..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Size Change: +11.1 kB (+0.05%)

Total Size: 20.2 MB

📦 View Changed
Filename Size Change
packages/mcp/dist/extensions/analytics-parameters.js 6.53 kB +1.96 kB (+42.81%) 🚨
packages/mcp/dist/extensions/analytics-parameters.mjs 4.27 kB +1.73 kB (+68.16%) 🆘
packages/mcp/dist/extensions/capture.js 3.94 kB +90 B (+2.34%)
packages/mcp/dist/extensions/capture.mjs 2.58 kB +90 B (+3.62%)
packages/mcp/dist/extensions/constants.js 5.39 kB +616 B (+12.91%) ⚠️
packages/mcp/dist/extensions/constants.mjs 2.95 kB +425 B (+16.83%) ⚠️
packages/mcp/dist/extensions/context-parameters.js 2.75 kB -1.26 kB (-31.43%) 🎉
packages/mcp/dist/extensions/context-parameters.mjs 893 B -1.23 kB (-57.94%) 🏆
packages/mcp/dist/extensions/instrument-********.js 4.92 kB +131 B (+2.73%)
packages/mcp/dist/extensions/instrument-********.mjs 3.18 kB +116 B (+3.79%)
packages/mcp/dist/extensions/instrument-highlevel.js 12.7 kB +442 B (+3.62%)
packages/mcp/dist/extensions/instrument-highlevel.mjs 10.2 kB +300 B (+3.04%)
packages/mcp/dist/extensions/instrumentation.js 27.8 kB +1.32 kB (+4.99%) 🔍
packages/mcp/dist/extensions/instrumentation.mjs 21.9 kB +806 B (+3.83%)
packages/mcp/dist/extensions/model-parameters.js 3.49 kB +3.49 kB (new file) 🆕
packages/mcp/dist/extensions/model-parameters.mjs 1.41 kB +1.41 kB (new file) 🆕
packages/mcp/dist/extensions/posthog-events.js 11.7 kB +276 B (+2.42%)
packages/mcp/dist/extensions/posthog-events.mjs 7.98 kB +200 B (+2.57%)
packages/mcp/dist/extensions/truncation.js 11.5 kB +76 B (+0.67%)
packages/mcp/dist/extensions/truncation.mjs 9.79 kB +76 B (+0.78%)
ℹ️ View Unchanged
Filename Size Change
packages/ai/dist/anthropic/index.cjs 41.3 kB 0 B
packages/ai/dist/anthropic/index.mjs 41 kB 0 B
packages/ai/dist/gemini/index.cjs 40.9 kB 0 B
packages/ai/dist/gemini/index.mjs 40.8 kB 0 B
packages/ai/dist/index.cjs 63.4 kB 0 B
packages/ai/dist/index.mjs 63.3 kB 0 B
packages/ai/dist/langchain/index.cjs 42.5 kB 0 B
packages/ai/dist/langchain/index.mjs 42.4 kB 0 B
packages/ai/dist/openai-agents/index.cjs 31.8 kB 0 B
packages/ai/dist/openai-agents/index.mjs 31.7 kB 0 B
packages/ai/dist/openai/index.cjs 93.3 kB 0 B
packages/ai/dist/openai/index.mjs 92.9 kB 0 B
packages/ai/dist/otel/index.cjs 18.4 kB 0 B
packages/ai/dist/otel/index.mjs 18.3 kB 0 B
packages/ai/dist/vercel/index.cjs 53.5 kB 0 B
packages/ai/dist/vercel/index.mjs 53.5 kB 0 B
packages/browser-common/dist/client.js 603 B 0 B
packages/browser-common/dist/client.mjs 0 B 0 B 🆕
packages/browser-common/dist/config.js 1.43 kB 0 B
packages/browser-common/dist/config.mjs 223 B 0 B
packages/browser-common/dist/constants.js 1.66 kB 0 B
packages/browser-common/dist/constants.mjs 219 B 0 B
packages/browser-common/dist/disposable.js 1.63 kB 0 B
packages/browser-common/dist/disposable.mjs 386 B 0 B
packages/browser-common/dist/extension-runtime.js 3.07 kB 0 B
packages/browser-common/dist/extension-runtime.mjs 1.83 kB 0 B
packages/browser-common/dist/extension.js 603 B 0 B
packages/browser-common/dist/extension.mjs 0 B 0 B 🆕
packages/browser-common/dist/index.js 3.08 kB 0 B
packages/browser-common/dist/index.mjs 170 B 0 B
packages/browser-common/dist/persistence.js 603 B 0 B
packages/browser-common/dist/persistence.mjs 0 B 0 B 🆕
packages/browser-common/dist/pubsub.js 2.23 kB 0 B
packages/browser-common/dist/pubsub.mjs 993 B 0 B
packages/browser-common/dist/token.js 603 B 0 B
packages/browser-common/dist/token.mjs 0 B 0 B 🆕
packages/browser-common/dist/types/compression.js 1.28 kB 0 B
packages/browser-common/dist/types/compression.mjs 93 B 0 B
packages/browser-common/dist/types/index.js 4.11 kB 0 B
packages/browser-common/dist/types/index.mjs 144 B 0 B
packages/browser-common/dist/types/network-recording.js 603 B 0 B
packages/browser-common/dist/types/network-recording.mjs 0 B 0 B 🆕
packages/browser-common/dist/types/remote-config.js 603 B 0 B
packages/browser-common/dist/types/remote-config.mjs 0 B 0 B 🆕
packages/browser-common/dist/types/surveys.js 4.55 kB 0 B
packages/browser-common/dist/types/surveys.mjs 2.17 kB 0 B
packages/browser-common/dist/utils/array-at-********.js 628 B 0 B
packages/browser-common/dist/utils/array-at-********.mjs 425 B 0 B
packages/browser-common/dist/utils/autocapture-utils.js 24 kB 0 B
packages/browser-common/dist/utils/autocapture-utils.mjs 18.5 kB 0 B
packages/browser-common/dist/utils/blocked-uas.js 2.1 kB 0 B
packages/browser-common/dist/utils/blocked-uas.mjs 598 B 0 B
packages/browser-common/dist/utils/cookie-utils.js 1.89 kB 0 B
packages/browser-common/dist/utils/cookie-utils.mjs 673 B 0 B
packages/browser-common/dist/utils/device-model-utils.js 1.98 kB 0 B
packages/browser-common/dist/utils/device-model-utils.mjs 678 B 0 B
packages/browser-common/dist/utils/element-utils.js 2.46 kB 0 B
packages/browser-common/dist/utils/element-utils.mjs 804 B 0 B
packages/browser-common/dist/utils/elements-chain-utils.js 2.77 kB 0 B
packages/browser-common/dist/utils/elements-chain-utils.mjs 1.23 kB 0 B
packages/browser-common/dist/utils/encode-utils.js 1.4 kB 0 B
packages/browser-common/dist/utils/encode-utils.mjs 205 B 0 B
packages/browser-common/dist/utils/event-utils.js 15.7 kB 0 B
packages/browser-common/dist/utils/event-utils.mjs 10 kB 0 B
packages/browser-common/dist/utils/general-utils.js 7.31 kB 0 B
packages/browser-common/dist/utils/general-utils.mjs 4.49 kB 0 B
packages/browser-common/dist/utils/globals.js 2.78 kB 0 B
packages/browser-common/dist/utils/globals.mjs 860 B 0 B
packages/browser-common/dist/utils/logger.js 3.4 kB 0 B
packages/browser-common/dist/utils/logger.mjs 1.61 kB 0 B
packages/browser-common/dist/utils/matcher-utils.js 2.85 kB 0 B
packages/browser-common/dist/utils/matcher-utils.mjs 1.33 kB 0 B
packages/browser-common/dist/utils/promise-utils.js 1.36 kB 0 B
packages/browser-common/dist/utils/promise-utils.mjs 169 B 0 B
packages/browser-common/dist/utils/property-utils.js 3.53 kB 0 B
packages/browser-common/dist/utils/property-utils.mjs 1.6 kB 0 B
packages/browser-common/dist/utils/prototype-utils.js 3.51 kB 0 B
packages/browser-common/dist/utils/prototype-utils.mjs 1.86 kB 0 B
packages/browser-common/dist/utils/regex-utils.js 1.45 kB 0 B
packages/browser-common/dist/utils/regex-utils.mjs 113 B 0 B
packages/browser-common/dist/utils/request-utils.js 6.73 kB 0 B
packages/browser-common/dist/utils/request-utils.mjs 4.19 kB 0 B
packages/browser-common/dist/utils/simple-event-emitter.js 1.76 kB 0 B
packages/browser-common/dist/utils/simple-event-emitter.mjs 553 B 0 B
packages/browser-common/dist/utils/stylesheet-loader.js 2.13 kB 0 B
packages/browser-common/dist/utils/stylesheet-loader.mjs 823 B 0 B
packages/browser-common/dist/utils/type-utils.js 1.59 kB 0 B
packages/browser-common/dist/utils/type-utils.mjs 267 B 0 B
packages/browser-common/dist/utils/url-targeting-utils.js 2.35 kB 0 B
packages/browser-common/dist/utils/url-targeting-utils.mjs 863 B 0 B
packages/browser-common/dist/utils/uuidv7.js 6.66 kB 0 B
packages/browser-common/dist/utils/uuidv7.mjs 5.18 kB 0 B
packages/browser/dist/all-external-dependencies.js 367 kB 0 B
packages/browser/dist/array.full.es5.js 473 kB 0 B
packages/browser/dist/array.full.js 596 kB 0 B
packages/browser/dist/array.full.no-********.js 647 kB 0 B
packages/browser/dist/array.js 267 kB 0 B
packages/browser/dist/array.no-********.js 301 kB 0 B
packages/browser/dist/conversations.js 68.2 kB 0 B
packages/browser/dist/crisp-chat-integration.js 2.03 kB 0 B
packages/browser/dist/customizations.full.js 15.9 kB 0 B
packages/browser/dist/customizations.js 15.8 kB 0 B
packages/browser/dist/dead-clicks-autocapture.js 18.2 kB 0 B
packages/browser/dist/default-extensions.js 264 kB 0 B
packages/browser/dist/element-inference.js 5.62 kB 0 B
packages/browser/dist/exception-autocapture.js 13.6 kB 0 B
packages/browser/dist/extension-bundles.js 149 kB 0 B
packages/browser/dist/external-scripts-loader.js 3.6 kB 0 B
packages/browser/dist/intercom-integration.js 2.08 kB 0 B
packages/browser/dist/lazy-********.js 191 kB 0 B
packages/browser/dist/logs.js 4.94 kB 0 B
packages/browser/dist/main.js 271 kB 0 B
packages/browser/dist/module.full.js 599 kB 0 B
packages/browser/dist/module.full.no-********.js 650 kB 0 B
packages/browser/dist/module.js 271 kB 0 B
packages/browser/dist/module.no-********.js 305 kB 0 B
packages/browser/dist/module.slim.js 133 kB 0 B
packages/browser/dist/module.slim.no-********.js 144 kB 0 B
packages/browser/dist/posthog-********.js 191 kB 0 B
packages/browser/dist/product-tours-preview.js 82.4 kB 0 B
packages/browser/dist/product-tours.js 124 kB 0 B
packages/browser/dist/recorder-v2.js 126 kB 0 B
packages/browser/dist/recorder.js 126 kB 0 B
packages/browser/dist/rrweb-plugin-console-record.js 6.99 kB 0 B
packages/browser/dist/rrweb-types.js 2.33 kB 0 B
packages/browser/dist/rrweb.js 318 kB 0 B
packages/browser/dist/surveys-preview.js 80.9 kB 0 B
packages/browser/dist/surveys.js 101 kB 0 B
packages/browser/dist/tracing-headers.js 3.71 kB 0 B
packages/browser/dist/web-vitals-soft-navs.js 9.9 kB 0 B
packages/browser/dist/web-vitals-with-attribution-soft-navs.js 25.1 kB 0 B
packages/browser/dist/web-vitals-with-attribution.js 18.4 kB 0 B
packages/browser/dist/web-vitals.js 6.91 kB 0 B
packages/browser/react/dist/esm/index.js 22.5 kB 0 B
packages/browser/react/dist/esm/slim/index.js 18.9 kB 0 B
packages/browser/react/dist/esm/surveys/index.js 4.75 kB 0 B
packages/browser/react/dist/umd/index.js 25.9 kB 0 B
packages/browser/react/dist/umd/slim/index.js 21.8 kB 0 B
packages/browser/react/dist/umd/surveys/index.js 5.52 kB 0 B
packages/convex/dist/client/feature-flags/crypto.js 76 B 0 B
packages/convex/dist/client/feature-flags/evaluator.js 14.9 kB 0 B
packages/convex/dist/client/feature-flags/index.js 196 B 0 B
packages/convex/dist/client/feature-flags/match-********.js 5.08 kB 0 B
packages/convex/dist/client/feature-flags/types.js 44 B 0 B
packages/convex/dist/client/index.js 14.8 kB 0 B
packages/convex/dist/component/_generated/api.js 712 B 0 B
packages/convex/dist/component/_generated/component.js 212 B 0 B
packages/convex/dist/component/_generated/dataModel.js 230 B 0 B
packages/convex/dist/component/_generated/server.js 3.74 kB 0 B
packages/convex/dist/component/convex.config.js 1.66 kB 0 B
packages/convex/dist/component/crons.js 969 B 0 B
packages/convex/dist/component/lib.js 24.8 kB 0 B
packages/convex/dist/component/schema.js 1.17 kB 0 B
packages/convex/dist/component/version.js 67 B 0 B
packages/core/dist/cookie.js 5.34 kB 0 B
packages/core/dist/cookie.mjs 3.12 kB 0 B
packages/core/dist/error-tracking/chunk-ids.js 2.54 kB 0 B
packages/core/dist/error-tracking/chunk-ids.mjs 1.31 kB 0 B
packages/core/dist/error-tracking/coercers/dom-exception-coercer.js 2.3 kB 0 B
packages/core/dist/error-tracking/coercers/dom-exception-coercer.mjs 993 B 0 B
packages/core/dist/error-tracking/coercers/error-coercer.js 2.13 kB 0 B
packages/core/dist/error-tracking/coercers/error-coercer.mjs 888 B 0 B
packages/core/dist/error-tracking/coercers/error-event-coercer.js 2.37 kB 0 B
packages/core/dist/error-tracking/coercers/error-event-coercer.mjs 1.07 kB 0 B
packages/core/dist/error-tracking/coercers/event-coercer.js 1.82 kB 0 B
packages/core/dist/error-tracking/coercers/event-coercer.mjs 548 B 0 B
packages/core/dist/error-tracking/coercers/index.js 6.79 kB 0 B
packages/core/dist/error-tracking/coercers/index.mjs 326 B 0 B
packages/core/dist/error-tracking/coercers/object-coercer.js 4.04 kB 0 B
packages/core/dist/error-tracking/coercers/object-coercer.mjs 2.53 kB 0 B
packages/core/dist/error-tracking/coercers/primitive-coercer.js 1.67 kB 0 B
packages/core/dist/error-tracking/coercers/primitive-coercer.mjs 419 B 0 B
packages/core/dist/error-tracking/coercers/promise-rejection-event.js 2.59 kB 0 B
packages/core/dist/error-tracking/coercers/promise-rejection-event.mjs 1.25 kB 0 B
packages/core/dist/error-tracking/coercers/string-coercer.js 2.01 kB 0 B
packages/core/dist/error-tracking/coercers/string-coercer.mjs 820 B 0 B
packages/core/dist/error-tracking/coercers/utils.js 2.06 kB 0 B
packages/core/dist/error-tracking/coercers/utils.mjs 716 B 0 B
packages/core/dist/error-tracking/error-properties-builder.js 5.56 kB 0 B
packages/core/dist/error-tracking/error-properties-builder.mjs 4.23 kB 0 B
packages/core/dist/error-tracking/exception-steps.js 6.01 kB 0 B
packages/core/dist/error-tracking/exception-steps.mjs 3.84 kB 0 B
packages/core/dist/error-tracking/index.js 5.32 kB 0 B
packages/core/dist/error-tracking/index.mjs 222 B 0 B
packages/core/dist/error-tracking/parsers/base.js 2 kB 0 B
packages/core/dist/error-tracking/parsers/base.mjs 627 B 0 B
packages/core/dist/error-tracking/parsers/chrome.js 2.73 kB 0 B
packages/core/dist/error-tracking/parsers/chrome.mjs 1.32 kB 0 B
packages/core/dist/error-tracking/parsers/gecko.js 2.47 kB 0 B
packages/core/dist/error-tracking/parsers/gecko.mjs 1.13 kB 0 B
packages/core/dist/error-tracking/parsers/index.js 4.75 kB 0 B
packages/core/dist/error-tracking/parsers/index.mjs 2.1 kB 0 B
packages/core/dist/error-tracking/parsers/node.js 4.21 kB 0 B
packages/core/dist/error-tracking/parsers/node.mjs 2.95 kB 0 B
packages/core/dist/error-tracking/parsers/opera.js 2.26 kB 0 B
packages/core/dist/error-tracking/parsers/opera.mjs 746 B 0 B
packages/core/dist/error-tracking/parsers/safari.js 1.88 kB 0 B
packages/core/dist/error-tracking/parsers/safari.mjs 574 B 0 B
packages/core/dist/error-tracking/parsers/winjs.js 1.72 kB 0 B
packages/core/dist/error-tracking/parsers/winjs.mjs 426 B 0 B
packages/core/dist/error-tracking/release.js 1.42 kB 0 B
packages/core/dist/error-tracking/release.mjs 203 B 0 B
packages/core/dist/error-tracking/types.js 1.33 kB 0 B
packages/core/dist/error-tracking/types.mjs 131 B 0 B
packages/core/dist/error-tracking/utils.js 1.8 kB 0 B
packages/core/dist/error-tracking/utils.mjs 604 B 0 B
packages/core/dist/eventemitter.js 1.78 kB 0 B
packages/core/dist/eventemitter.mjs 571 B 0 B
packages/core/dist/featureFlagLocalEvaluation.js 15.3 kB 0 B
packages/core/dist/featureFlagLocalEvaluation.mjs 12.8 kB 0 B
packages/core/dist/featureFlagUtils.js 8.52 kB 0 B
packages/core/dist/featureFlagUtils.mjs 5.48 kB 0 B
packages/core/dist/gzip.js 5.73 kB 0 B
packages/core/dist/gzip.mjs 3.85 kB 0 B
packages/core/dist/index.js 23.2 kB 0 B
packages/core/dist/index.mjs 2.47 kB 0 B
packages/core/dist/logs/index.js 10.5 kB 0 B
packages/core/dist/logs/index.mjs 8.89 kB 0 B
packages/core/dist/logs/logs-utils.js 12.3 kB 0 B
packages/core/dist/logs/logs-utils.mjs 9.59 kB 0 B
packages/core/dist/logs/types.js 603 B 0 B
packages/core/dist/logs/types.mjs 0 B 0 B 🆕
packages/core/dist/metrics/config.js 1.95 kB 0 B
packages/core/dist/metrics/config.mjs 735 B 0 B
packages/core/dist/metrics/index.js 14.4 kB 0 B
packages/core/dist/metrics/index.mjs 12 kB 0 B
packages/core/dist/metrics/metrics-utils.js 3.86 kB 0 B
packages/core/dist/metrics/metrics-utils.mjs 1.97 kB 0 B
packages/core/dist/metrics/types.js 603 B 0 B
packages/core/dist/metrics/types.mjs 0 B 0 B 🆕
packages/core/dist/posthog-core-stateless.js 46.9 kB 0 B
packages/core/dist/posthog-core-stateless.mjs 43.7 kB 0 B
packages/core/dist/posthog-core.js 49.5 kB 0 B
packages/core/dist/posthog-core.mjs 43.9 kB 0 B
packages/core/dist/surveys/activation.js 2.2 kB 0 B
packages/core/dist/surveys/activation.mjs 572 B 0 B
packages/core/dist/surveys/events.js 4.21 kB 0 B
packages/core/dist/surveys/events.mjs 1.99 kB 0 B
packages/core/dist/surveys/index.js 6.54 kB 0 B
packages/core/dist/surveys/index.mjs 1.4 kB 0 B
packages/core/dist/surveys/keys.js 1.7 kB 0 B
packages/core/dist/surveys/keys.mjs 350 B 0 B
packages/core/dist/surveys/property-********.js 3.69 kB 0 B
packages/core/dist/surveys/property-********.mjs 2.14 kB 0 B
packages/core/dist/surveys/translations.js 9.09 kB 0 B
packages/core/dist/surveys/translations.mjs 6.83 kB 0 B
packages/core/dist/surveys/validation.js 3.06 kB 0 B
packages/core/dist/surveys/validation.mjs 1.51 kB 0 B
packages/core/dist/testing/index.js 2.93 kB 0 B
packages/core/dist/testing/index.mjs 79 B 0 B
packages/core/dist/testing/PostHogCoreTestClient.js 3.24 kB 0 B
packages/core/dist/testing/PostHogCoreTestClient.mjs 1.83 kB 0 B
packages/core/dist/testing/test-utils.js 2.83 kB 0 B
packages/core/dist/testing/test-utils.mjs 1.15 kB 0 B
packages/core/dist/tracing-headers.js 3.38 kB 0 B
packages/core/dist/tracing-headers.mjs 2.08 kB 0 B
packages/core/dist/types.js 8.35 kB 0 B
packages/core/dist/types.mjs 5.23 kB 0 B
packages/core/dist/utils/bot-detection.js 3.28 kB 0 B
packages/core/dist/utils/bot-detection.mjs 1.95 kB 0 B
packages/core/dist/utils/browser-utils.js 1.48 kB 0 B
packages/core/dist/utils/browser-utils.mjs 182 B 0 B
packages/core/dist/utils/bucketed-rate-limiter.js 4.23 kB 0 B
packages/core/dist/utils/bucketed-rate-limiter.mjs 2.22 kB 0 B
packages/core/dist/utils/index.js 15.9 kB 0 B
packages/core/dist/utils/index.mjs 3.05 kB 0 B
packages/core/dist/utils/json-utils.js 6.67 kB 0 B
packages/core/dist/utils/json-utils.mjs 4.45 kB 0 B
packages/core/dist/utils/logger.js 2.58 kB 0 B
packages/core/dist/utils/logger.mjs 1.29 kB 0 B
packages/core/dist/utils/number-utils.js 3.32 kB 0 B
packages/core/dist/utils/number-utils.mjs 1.68 kB 0 B
packages/core/dist/utils/promise-queue.js 2.48 kB 0 B
packages/core/dist/utils/promise-queue.mjs 1.25 kB 0 B
packages/core/dist/utils/string-utils.js 3.73 kB 0 B
packages/core/dist/utils/string-utils.mjs 1.97 kB 0 B
packages/core/dist/utils/type-utils.js 7.43 kB 0 B
packages/core/dist/utils/type-utils.mjs 3.28 kB 0 B
packages/core/dist/utils/user-agent-utils.js 17.7 kB 0 B
packages/core/dist/utils/user-agent-utils.mjs 14.2 kB 0 B
packages/core/dist/vendor/uuidv7.js 8.29 kB 0 B
packages/core/dist/vendor/uuidv7.mjs 6.72 kB 0 B
packages/mcp/dist/extensions/client-********.js 6.23 kB 0 B
packages/mcp/dist/extensions/client-********.mjs 3.71 kB 0 B
packages/mcp/dist/extensions/compatibility.js 5.36 kB 0 B
packages/mcp/dist/extensions/compatibility.mjs 3.4 kB 0 B
packages/mcp/dist/extensions/conversation-id.js 6.31 kB 0 B
packages/mcp/dist/extensions/conversation-id.mjs 3.58 kB 0 B
packages/mcp/dist/extensions/detect.js 3.77 kB 0 B
packages/mcp/dist/extensions/detect.mjs 1.49 kB 0 B
packages/mcp/dist/extensions/event-types.js 1.68 kB 0 B
packages/mcp/dist/extensions/event-types.mjs 459 B 0 B
packages/mcp/dist/extensions/exceptions.js 2.57 kB 0 B
packages/mcp/dist/extensions/exceptions.mjs 1.19 kB 0 B
packages/mcp/dist/extensions/headers.js 1.98 kB 0 B
packages/mcp/dist/extensions/headers.mjs 643 B 0 B
packages/mcp/dist/extensions/ids.js 2.01 kB 0 B
packages/mcp/dist/extensions/ids.mjs 637 B 0 B
packages/mcp/dist/extensions/intent.js 3.2 kB 0 B
packages/mcp/dist/extensions/intent.mjs 1.64 kB 0 B
packages/mcp/dist/extensions/internal.js 7.54 kB 0 B
packages/mcp/dist/extensions/internal.mjs 5.23 kB 0 B
packages/mcp/dist/extensions/lib-********.js 1.6 kB 0 B
packages/mcp/dist/extensions/lib-********.mjs 267 B 0 B
packages/mcp/dist/extensions/logger.js 1.72 kB 0 B
packages/mcp/dist/extensions/logger.mjs 380 B 0 B
packages/mcp/dist/extensions/mcp-********.js 4.68 kB 0 B
packages/mcp/dist/extensions/mcp-********.mjs 3.3 kB 0 B
packages/mcp/dist/extensions/mcp-sdk-compat.js 5.04 kB 0 B
packages/mcp/dist/extensions/mcp-sdk-compat.mjs 2.9 kB 0 B
packages/mcp/dist/extensions/output-instructions.js 6.11 kB 0 B
packages/mcp/dist/extensions/output-instructions.mjs 3.91 kB 0 B
packages/mcp/dist/extensions/posthog-mcp.js 6.94 kB 0 B
packages/mcp/dist/extensions/posthog-mcp.mjs 4.93 kB 0 B
packages/mcp/dist/extensions/request-headers.js 2.17 kB 0 B
packages/mcp/dist/extensions/request-headers.mjs 963 B 0 B
packages/mcp/dist/extensions/sanitization.js 4.49 kB 0 B
packages/mcp/dist/extensions/sanitization.mjs 2.86 kB 0 B
packages/mcp/dist/extensions/session-token.js 5.39 kB 0 B
packages/mcp/dist/extensions/session-token.mjs 3.62 kB 0 B
packages/mcp/dist/extensions/session.js 6.64 kB 0 B
packages/mcp/dist/extensions/session.mjs 4.12 kB 0 B
packages/mcp/dist/extensions/sink.js 4.37 kB 0 B
packages/mcp/dist/extensions/sink.mjs 2.67 kB 0 B
packages/mcp/dist/extensions/tools.js 3.51 kB 0 B
packages/mcp/dist/extensions/tools.mjs 1.63 kB 0 B
packages/mcp/dist/extensions/tracing-helpers.js 2.41 kB 0 B
packages/mcp/dist/extensions/tracing-helpers.mjs 772 B 0 B
packages/mcp/dist/extensions/transport-********.js 2.91 kB 0 B
packages/mcp/dist/extensions/transport-********.mjs 1.09 kB 0 B
packages/mcp/dist/index.js 8.78 kB 0 B
packages/mcp/dist/index.mjs 4.96 kB 0 B
packages/mcp/dist/types.js 603 B 0 B
packages/mcp/dist/types.mjs 0 B 0 B 🆕
packages/mcp/dist/version.js 1.21 kB 0 B
packages/mcp/dist/version.mjs 46 B 0 B
packages/next/dist/app/PostHogProvider.js 5.37 kB 0 B
packages/next/dist/client/ClientPostHogProvider.js 2.28 kB 0 B
packages/next/dist/client/hooks.js 172 B 0 B
packages/next/dist/client/PostHogPageView.js 1.76 kB 0 B
packages/next/dist/index.client.js 401 B 0 B
packages/next/dist/index.edge.js 570 B 0 B
packages/next/dist/index.js 554 B 0 B
packages/next/dist/index.react-server.js 420 B 0 B
packages/next/dist/middleware/postHogMiddleware.js 4.08 kB 0 B
packages/next/dist/pages.client.js 225 B 0 B
packages/next/dist/pages.edge.js 294 B 0 B
packages/next/dist/pages.js 347 B 0 B
packages/next/dist/pages/createPostHog.js 1.48 kB 0 B
packages/next/dist/pages/getServerSidePostHog.js 1.48 kB 0 B
packages/next/dist/pages/PostHogPageView.js 1.55 kB 0 B
packages/next/dist/pages/PostHogProvider.js 1.58 kB 0 B
packages/next/dist/server.edge.js 795 B 0 B
packages/next/dist/server/captureRequestError.js 5.26 kB 0 B
packages/next/dist/server/clientCache.edge.js 305 B 0 B
packages/next/dist/server/clientCache.js 1.54 kB 0 B
packages/next/dist/server/clientCache.node.js 305 B 0 B
packages/next/dist/server/createPostHog.js 1.44 kB 0 B
packages/next/dist/server/getPostHog.js 3.45 kB 0 B
packages/next/dist/server/onRequestError.js 1.39 kB 0 B
packages/next/dist/server/onRequestError.types.js 59 B 0 B
packages/next/dist/shared/browser.js 195 B 0 B
packages/next/dist/shared/config.js 2.23 kB 0 B
packages/next/dist/shared/constants.js 201 B 0 B
packages/next/dist/shared/cookie.js 540 B 0 B
packages/next/dist/shared/identity.js 2.56 kB 0 B
packages/next/dist/shared/tracing-headers.js 2.18 kB 0 B
packages/nextjs-config/dist/config.js 6.1 kB 0 B
packages/nextjs-config/dist/config.mjs 4.53 kB 0 B
packages/nextjs-config/dist/index.js 2.24 kB 0 B
packages/nextjs-config/dist/index.mjs 30 B 0 B
packages/nextjs-config/dist/strip-sourcemap-********.js 3.63 kB 0 B
packages/nextjs-config/dist/strip-sourcemap-********.mjs 1.77 kB 0 B
packages/nextjs-config/dist/utils.js 2.94 kB 0 B
packages/nextjs-config/dist/utils.mjs 826 B 0 B
packages/node/dist/ai-capture/batching.js 2.61 kB 0 B
packages/node/dist/ai-capture/batching.mjs 1.21 kB 0 B
packages/node/dist/ai-capture/routing.js 1.87 kB 0 B
packages/node/dist/ai-capture/routing.mjs 264 B 0 B
packages/node/dist/capture-v1/config.js 1.5 kB 0 B
packages/node/dist/capture-v1/config.mjs 292 B 0 B
packages/node/dist/capture-v1/errors.js 1.89 kB 0 B
packages/node/dist/capture-v1/errors.mjs 694 B 0 B
packages/node/dist/capture-v1/routing.js 1.68 kB 0 B
packages/node/dist/capture-v1/routing.mjs 279 B 0 B
packages/node/dist/capture-v1/sender.js 11.4 kB 0 B
packages/node/dist/capture-v1/sender.mjs 9.94 kB 0 B
packages/node/dist/capture-v1/transform.js 5.13 kB 0 B
packages/node/dist/capture-v1/transform.mjs 3.65 kB 0 B
packages/node/dist/capture-v1/types.js 603 B 0 B
packages/node/dist/capture-v1/types.mjs 0 B 0 B 🆕
packages/node/dist/client.js 59.4 kB 0 B
packages/node/dist/client.mjs 56 kB 0 B
packages/node/dist/entrypoints/index.edge.js 3.85 kB 0 B
packages/node/dist/entrypoints/index.edge.mjs 720 B 0 B
packages/node/dist/entrypoints/index.node.js 6.05 kB 0 B
packages/node/dist/entrypoints/index.node.mjs 1.43 kB 0 B
packages/node/dist/entrypoints/nestjs.js 2.31 kB 0 B
packages/node/dist/entrypoints/nestjs.mjs 42 B 0 B
packages/node/dist/experimental.js 870 B 0 B
packages/node/dist/experimental.mjs 267 B 0 B
packages/node/dist/exports.js 6.75 kB 0 B
packages/node/dist/exports.mjs 582 B 0 B
packages/node/dist/extensions/context/context.js 2.13 kB 0 B
packages/node/dist/extensions/context/context.mjs 863 B 0 B
packages/node/dist/extensions/context/types.js 603 B 0 B
packages/node/dist/extensions/context/types.mjs 0 B 0 B 🆕
packages/node/dist/extensions/error-tracking/autocapture.js 5.19 kB 0 B
packages/node/dist/extensions/error-tracking/autocapture.mjs 3.62 kB 0 B
packages/node/dist/extensions/error-tracking/index.js 4.38 kB 0 B
packages/node/dist/extensions/error-tracking/index.mjs 3.17 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/context-lines.node.js 11.6 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs 9.64 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/module.node.js 2.78 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/module.node.mjs 1.45 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/relative-path.node.js 1.97 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/relative-path.node.mjs 624 B 0 B
packages/node/dist/extensions/express.js 4.97 kB 0 B
packages/node/dist/extensions/express.mjs 2.78 kB 0 B
packages/node/dist/extensions/feature-flags/cache.js 603 B 0 B
packages/node/dist/extensions/feature-flags/cache.mjs 0 B 0 B 🆕
packages/node/dist/extensions/feature-flags/crypto.js 1.27 kB 0 B
packages/node/dist/extensions/feature-flags/crypto.mjs 63 B 0 B
packages/node/dist/extensions/feature-flags/feature-flags.js 31.2 kB 0 B
packages/node/dist/extensions/feature-flags/feature-flags.mjs 28.8 kB 0 B
packages/node/dist/extensions/nestjs.js 5.62 kB 0 B
packages/node/dist/extensions/nestjs.mjs 3.42 kB 0 B
packages/node/dist/extensions/sentry-integration.js 4.88 kB 0 B
packages/node/dist/extensions/sentry-integration.mjs 3.36 kB 0 B
packages/node/dist/extensions/tracing-headers.js 3.31 kB 0 B
packages/node/dist/extensions/tracing-headers.mjs 1.53 kB 0 B
packages/node/dist/extensions/url-utils.js 2.22 kB 0 B
packages/node/dist/extensions/url-utils.mjs 785 B 0 B
packages/node/dist/feature-flag-evaluations.js 6.12 kB 0 B
packages/node/dist/feature-flag-evaluations.mjs 4.77 kB 0 B
packages/node/dist/gzip.node.js 1.74 kB 0 B
packages/node/dist/gzip.node.mjs 416 B 0 B
packages/node/dist/storage-memory.js 1.52 kB 0 B
packages/node/dist/storage-memory.mjs 297 B 0 B
packages/node/dist/types.js 1.43 kB 0 B
packages/node/dist/types.mjs 224 B 0 B
packages/node/dist/version.js 1.21 kB 0 B
packages/node/dist/version.mjs 46 B 0 B
packages/nuxt/dist/module.mjs 5.92 kB 0 B
packages/nuxt/dist/runtime/composables/useFeatureFlagEnabled.js 566 B 0 B
packages/nuxt/dist/runtime/composables/useFeatureFlagPayload.js 690 B 0 B
packages/nuxt/dist/runtime/composables/useFeatureFlagVariantKey.js 591 B 0 B
packages/nuxt/dist/runtime/composables/usePostHog.js 128 B 0 B
packages/nuxt/dist/runtime/nitro-plugin-v2.js 480 B 0 B
packages/nuxt/dist/runtime/nitro-plugin-v3.js 574 B 0 B
packages/nuxt/dist/runtime/nitro-plugin.js 1.03 kB 0 B
packages/nuxt/dist/runtime/vue-plugin.js 1.13 kB 0 B
packages/openfeature-node-provider/dist/index.js 1.76 kB 0 B
packages/openfeature-node-provider/dist/index.mjs 190 B 0 B
packages/openfeature-node-provider/dist/mapping.js 5.32 kB 0 B
packages/openfeature-node-provider/dist/mapping.mjs 3.21 kB 0 B
packages/openfeature-node-provider/dist/provider.js 3.99 kB 0 B
packages/openfeature-node-provider/dist/provider.mjs 2.6 kB 0 B
packages/openfeature-web-provider/dist/index.js 1.75 kB 0 B
packages/openfeature-web-provider/dist/index.mjs 184 B 0 B
packages/openfeature-web-provider/dist/mapping.js 5.29 kB 0 B
packages/openfeature-web-provider/dist/mapping.mjs 3.18 kB 0 B
packages/openfeature-web-provider/dist/provider.js 4.41 kB 0 B
packages/openfeature-web-provider/dist/provider.mjs 3.06 kB 0 B
packages/plugin-utils/dist/chunk-ids.js 3.86 kB 0 B
packages/plugin-utils/dist/chunk-ids.mjs 2.05 kB 0 B
packages/plugin-utils/dist/cli.js 4.37 kB 0 B
packages/plugin-utils/dist/cli.mjs 2.72 kB 0 B
packages/plugin-utils/dist/config.js 3.5 kB 0 B
packages/plugin-utils/dist/config.mjs 2.26 kB 0 B
packages/plugin-utils/dist/index.js 4.98 kB 0 B
packages/plugin-utils/dist/index.mjs 250 B 0 B
packages/plugin-utils/dist/spawn-local.js 3.08 kB 0 B
packages/plugin-utils/dist/spawn-local.mjs 1.66 kB 0 B
packages/plugin-utils/dist/utils.js 3.27 kB 0 B
packages/plugin-utils/dist/utils.mjs 1.3 kB 0 B
packages/react-native/dist/autocapture.js 6.27 kB 0 B
packages/react-native/dist/error-tracking/index.js 9.97 kB 0 B
packages/react-native/dist/error-tracking/utils.js 2.58 kB 0 B
packages/react-native/dist/frameworks/wix-navigation.js 1.3 kB 0 B
packages/react-native/dist/hooks/useFeatureFlag.js 1.86 kB 0 B
packages/react-native/dist/hooks/useFeatureFlagResult.js 983 B 0 B
packages/react-native/dist/hooks/useFeatureFlags.js 941 B 0 B
packages/react-native/dist/hooks/useNavigationTracker.js 2.45 kB 0 B
packages/react-native/dist/hooks/usePostHog.js 544 B 0 B
packages/react-native/dist/hooks/utils.js 988 B 0 B
packages/react-native/dist/index.js 4.33 kB 0 B
packages/react-native/dist/logs-********.js 3.66 kB 0 B
packages/react-native/dist/native-deps.js 8.73 kB 0 B
packages/react-native/dist/optional/OptionalAsyncStorage.js 299 B 0 B
packages/react-native/dist/optional/OptionalExpoApplication.js 377 B 0 B
packages/react-native/dist/optional/OptionalExpoDevice.js 347 B 0 B
packages/react-native/dist/optional/OptionalExpoFileSystem.js 386 B 0 B
packages/react-native/dist/optional/OptionalExpoFileSystemLegacy.js 423 B 0 B
packages/react-native/dist/optional/OptionalExpoLocalization.js 383 B 0 B
packages/react-native/dist/optional/OptionalPlugin.js 891 B 0 B
packages/react-native/dist/optional/OptionalReactNativeDeviceInfo.js 415 B 0 B
packages/react-native/dist/optional/OptionalReactNativeLocalize.js 303 B 0 B
packages/react-native/dist/optional/OptionalReactNativeNavigation.js 415 B 0 B
packages/react-native/dist/optional/OptionalReactNativeNavigationWix.js 443 B 0 B
packages/react-native/dist/optional/OptionalReactNativeSafeArea.js 644 B 0 B
packages/react-native/dist/optional/OptionalReactNativeSvg.js 872 B 0 B
packages/react-native/dist/posthog-rn.js 67.4 kB 0 B
packages/react-native/dist/PostHogContext.js 329 B 0 B
packages/react-native/dist/PostHogErrorBoundary.js 3.19 kB 0 B
packages/react-native/dist/PostHogMaskView.js 1.68 kB 0 B
packages/react-native/dist/PostHogProvider.js 4.55 kB 0 B
packages/react-native/dist/storage.js 5.76 kB 0 B
packages/react-native/dist/surveys/components/BottomSection.js 1.51 kB 0 B
packages/react-native/dist/surveys/components/Cancel.js 968 B 0 B
packages/react-native/dist/surveys/components/ConfirmationMessage.js 1.71 kB 0 B
packages/react-native/dist/surveys/components/IntroMessage.js 1.6 kB 0 B
packages/react-native/dist/surveys/components/QuestionHeader.js 1.43 kB 0 B
packages/react-native/dist/surveys/components/QuestionTypes.js 14 kB 0 B
packages/react-native/dist/surveys/components/SurveyModal.js 7.24 kB 0 B
packages/react-native/dist/surveys/components/Surveys.js 6.58 kB 0 B
packages/react-native/dist/surveys/getActiveMatchingSurveys.js 2.69 kB 0 B
packages/react-native/dist/surveys/icons.js 10 kB 0 B
packages/react-native/dist/surveys/index.js 600 B 0 B
packages/react-native/dist/surveys/PostHogSurveyProvider.js 6.73 kB 0 B
packages/react-native/dist/surveys/safeStyleSheet.js 448 B 0 B
packages/react-native/dist/surveys/survey-translations.js 1.11 kB 0 B
packages/react-native/dist/surveys/surveys-utils.js 11.2 kB 0 B
packages/react-native/dist/surveys/useActivatedSurveys.js 3.68 kB 0 B
packages/react-native/dist/surveys/useSurveyStorage.js 2.48 kB 0 B
packages/react-native/dist/tooling/expoconfig.js 17.3 kB 0 B
packages/react-native/dist/tooling/metroconfig.js 2.32 kB 0 B
packages/react-native/dist/tooling/posthogMetroSerializer.js 7.74 kB 0 B
packages/react-native/dist/tooling/utils.js 4.2 kB 0 B
packages/react-native/dist/tooling/vendor/expo/expoconfig.js 70 B 0 B
packages/react-native/dist/tooling/vendor/metro/countLines.js 237 B 0 B
packages/react-native/dist/tooling/vendor/metro/utils.js 3.51 kB 0 B
packages/react-native/dist/types.js 70 B 0 B
packages/react-native/dist/utils.js 1.3 kB 0 B
packages/react-native/dist/version.js 130 B 0 B
packages/react/dist/esm/index.js 22.5 kB 0 B
packages/react/dist/esm/slim/index.js 18.9 kB 0 B
packages/react/dist/esm/surveys/index.js 4.75 kB 0 B
packages/react/dist/umd/index.js 25.9 kB 0 B
packages/react/dist/umd/slim/index.js 21.8 kB 0 B
packages/react/dist/umd/surveys/index.js 5.52 kB 0 B
packages/rollup-plugin/dist/index.js 7.6 kB 0 B
packages/rrweb/all/dist/rrweb-all.cjs 704 kB 0 B
packages/rrweb/all/dist/rrweb-all.js 703 kB 0 B
packages/rrweb/all/dist/rrweb-all.umd.cjs 707 kB 0 B
packages/rrweb/all/dist/rrweb-all.umd.min.cjs 327 kB 0 B
packages/rrweb/packer/dist/base-********.cjs 18.3 kB 0 B
packages/rrweb/packer/dist/base-********.js 18.2 kB 0 B
packages/rrweb/packer/dist/base-********.umd.cjs 18.7 kB 0 B
packages/rrweb/packer/dist/base-********.umd.min.cjs 9.5 kB 0 B
packages/rrweb/packer/dist/pack.cjs 347 B 0 B
packages/rrweb/packer/dist/pack.js 285 B 0 B
packages/rrweb/packer/dist/pack.umd.cjs 1.63 kB 0 B
packages/rrweb/packer/dist/pack.umd.min.cjs 1.11 kB 0 B
packages/rrweb/packer/dist/packer.cjs 257 B 0 B
packages/rrweb/packer/dist/packer.js 136 B 0 B
packages/rrweb/packer/dist/packer.umd.cjs 662 B 0 B
packages/rrweb/packer/dist/packer.umd.min.cjs 626 B 0 B
packages/rrweb/packer/dist/unpack.cjs 769 B 0 B
packages/rrweb/packer/dist/unpack.js 702 B 0 B
packages/rrweb/packer/dist/unpack.umd.cjs 1.17 kB 0 B
packages/rrweb/packer/dist/unpack.umd.min.cjs 955 B 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.cjs 37.6 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.js 37.5 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.umd.cjs 38 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-record/dist/rrweb-plugin-canvas-webrtc-record.umd.min.cjs 22.2 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.cjs 34.3 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.js 34.2 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.umd.cjs 34.7 kB 0 B
packages/rrweb/plugins/rrweb-plugin-canvas-webrtc-replay/dist/rrweb-plugin-canvas-webrtc-replay.umd.min.cjs 20.5 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.cjs 15.6 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.js 15.5 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.umd.cjs 16.1 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-record/dist/rrweb-plugin-console-record.umd.min.cjs 7.61 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-replay/dist/rrweb-plugin-console-replay.cjs 5.01 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-replay/dist/rrweb-plugin-console-replay.js 4.9 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-replay/dist/rrweb-plugin-console-replay.umd.cjs 5.44 kB 0 B
packages/rrweb/plugins/rrweb-plugin-console-replay/dist/rrweb-plugin-console-replay.umd.min.cjs 2.64 kB 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-record/dist/rrweb-plugin-sequential-id-record.cjs 681 B 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-record/dist/rrweb-plugin-sequential-id-record.js 548 B 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-record/dist/rrweb-plugin-sequential-id-record.umd.cjs 1.12 kB 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-record/dist/rrweb-plugin-sequential-id-record.umd.min.cjs 829 B 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-replay/dist/rrweb-plugin-sequential-id-replay.cjs 933 B 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-replay/dist/rrweb-plugin-sequential-id-replay.js 820 B 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-replay/dist/rrweb-plugin-sequential-id-replay.umd.cjs 1.37 kB 0 B
packages/rrweb/plugins/rrweb-plugin-sequential-id-replay/dist/rrweb-plugin-sequential-id-replay.umd.min.cjs 968 B 0 B
packages/rrweb/record/dist/rrweb-record.cjs 233 kB 0 B
packages/rrweb/record/dist/rrweb-record.js 233 kB 0 B
packages/rrweb/record/dist/rrweb-record.umd.cjs 234 kB 0 B
packages/rrweb/record/dist/rrweb-record.umd.min.cjs 107 kB 0 B
packages/rrweb/replay/dist/rrweb-replay.cjs 474 kB 0 B
packages/rrweb/replay/dist/rrweb-replay.js 474 kB 0 B
packages/rrweb/replay/dist/rrweb-replay.umd.cjs 477 kB 0 B
packages/rrweb/replay/dist/rrweb-replay.umd.min.cjs 224 kB 0 B
packages/rrweb/rrdom-nodejs/dist/rrdom-nodejs.cjs 160 kB 0 B
packages/rrweb/rrdom-nodejs/dist/rrdom-nodejs.js 160 kB 0 B
packages/rrweb/rrdom-nodejs/dist/rrdom-nodejs.umd.cjs 162 kB 0 B
packages/rrweb/rrdom-nodejs/dist/rrdom-nodejs.umd.min.cjs 74.9 kB 0 B
packages/rrweb/rrdom/dist/rrdom.cjs 185 kB 0 B
packages/rrweb/rrdom/dist/rrdom.js 185 kB 0 B
packages/rrweb/rrdom/dist/rrdom.umd.cjs 187 kB 0 B
packages/rrweb/rrdom/dist/rrdom.umd.min.cjs 85.4 kB 0 B
packages/rrweb/rrweb-snapshot/dist/record.cjs 39 kB 0 B
packages/rrweb/rrweb-snapshot/dist/record.js 37.3 kB 0 B
packages/rrweb/rrweb-snapshot/dist/record.umd.cjs 82.6 kB 0 B
packages/rrweb/rrweb-snapshot/dist/record.umd.min.cjs 37.2 kB 0 B
packages/rrweb/rrweb-snapshot/dist/replay.cjs 149 kB 0 B
packages/rrweb/rrweb-snapshot/dist/replay.js 148 kB 0 B
packages/rrweb/rrweb-snapshot/dist/replay.umd.cjs 193 kB 0 B
packages/rrweb/rrweb-snapshot/dist/replay.umd.min.cjs 85.8 kB 0 B
packages/rrweb/rrweb-snapshot/dist/rrweb-********.cjs 3.88 kB 0 B
packages/rrweb/rrweb-snapshot/dist/rrweb-********.js 2.29 kB 0 B
packages/rrweb/rrweb-snapshot/dist/rrweb-********.umd.cjs 260 kB 0 B
packages/rrweb/rrweb-snapshot/dist/rrweb-********.umd.min.cjs 109 kB 0 B
packages/rrweb/rrweb-snapshot/dist/types-********.cjs 37.3 kB 0 B
packages/rrweb/rrweb-snapshot/dist/types-********.js 36.1 kB 0 B
packages/rrweb/rrweb-snapshot/dist/types-********.umd.cjs 38.5 kB 0 B
packages/rrweb/rrweb-snapshot/dist/types-********.umd.min.cjs 17.2 kB 0 B
packages/rrweb/rrweb/dist/rrweb.cjs 688 kB 0 B
packages/rrweb/rrweb/dist/rrweb.js 687 kB 0 B
packages/rrweb/rrweb/dist/rrweb.umd.cjs 687 kB 0 B
packages/rrweb/rrweb/dist/rrweb.umd.min.cjs 318 kB 0 B
packages/rrweb/types/dist/rrweb-types.cjs 5.75 kB 0 B
packages/rrweb/types/dist/rrweb-types.js 5.46 kB 0 B
packages/rrweb/types/dist/rrweb-types.umd.cjs 6.16 kB 0 B
packages/rrweb/types/dist/rrweb-types.umd.min.cjs 2.86 kB 0 B
packages/rrweb/utils/dist/rrweb-utils.cjs 7.56 kB 0 B
packages/rrweb/utils/dist/rrweb-utils.js 7.1 kB 0 B
packages/rrweb/utils/dist/rrweb-utils.umd.cjs 7.97 kB 0 B
packages/rrweb/utils/dist/rrweb-utils.umd.min.cjs 4.04 kB 0 B
packages/types/dist/capture-log.js 603 B 0 B
packages/types/dist/capture-log.mjs 0 B 0 B 🆕
packages/types/dist/capture-metric.js 1.37 kB 0 B
packages/types/dist/capture-metric.mjs 93 B 0 B
packages/types/dist/capture.js 603 B 0 B
packages/types/dist/capture.mjs 0 B 0 B 🆕
packages/types/dist/common.js 603 B 0 B
packages/types/dist/common.mjs 0 B 0 B 🆕
packages/types/dist/feature-flags.js 603 B 0 B
packages/types/dist/feature-flags.mjs 0 B 0 B 🆕
packages/types/dist/index.js 1.45 kB 0 B
packages/types/dist/index.mjs 122 B 0 B
packages/types/dist/posthog-config.js 603 B 0 B
packages/types/dist/posthog-config.mjs 0 B 0 B 🆕
packages/types/dist/posthog.js 603 B 0 B
packages/types/dist/posthog.mjs 0 B 0 B 🆕
packages/types/dist/request.js 603 B 0 B
packages/types/dist/request.mjs 0 B 0 B 🆕
packages/types/dist/segment.js 603 B 0 B
packages/types/dist/segment.mjs 0 B 0 B 🆕
packages/types/dist/session-recording.js 603 B 0 B
packages/types/dist/session-recording.mjs 0 B 0 B 🆕
packages/types/dist/survey.js 603 B 0 B
packages/types/dist/survey.mjs 0 B 0 B 🆕
packages/types/dist/toolbar.js 603 B 0 B
packages/types/dist/toolbar.mjs 0 B 0 B 🆕
packages/types/dist/tree-shakeable.js 603 B 0 B
packages/types/dist/tree-shakeable.mjs 0 B 0 B 🆕
packages/web/dist/index.cjs 14 kB 0 B
packages/web/dist/index.mjs 14 kB 0 B
packages/webpack-plugin/dist/config.js 1.47 kB 0 B
packages/webpack-plugin/dist/config.mjs 480 B 0 B
packages/webpack-plugin/dist/index.js 7.39 kB 0 B
packages/webpack-plugin/dist/index.mjs 3.58 kB 0 B
tooling/changelog/dist/index.js 3.31 kB 0 B
tooling/rollup-utils/dist/index.js 1.17 kB 0 B

compressed-size-action

@marandaneto marandaneto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated advisory code review.

tools = addContextParameterToTools(tools, getContextDescription(data.options.context), data.logger)
}
if (data && isCaptureModelEnabled(data.options.captureModel)) {
tools = addModelParameterToTools(tools, getModelDescription(data.options.captureModel), data.logger)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocking: Inject the model parameter into the virtual tool — model injection runs before reportMissing appends get_more_tools, so with both options enabled the advertised virtual tool lacks llm_model and its missing-capability calls cannot self-report the model, contrary to the documented every-tool behavior.

* handling. Skip rules match `addContextParameterToTool`: a tool that already
* declares `llm_model` owns it, and complex schemas can't safely gain keys.
*/
export function addModelParameterToTool<TTool extends ModelInjectableTool>(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Reuse the existing parameter-injection implementation — this function and its batch wrapper duplicate almost all of addContextParameterToTool; a shared analytics-parameter helper would keep schema ownership, cloning, and required-field behavior from drifting.

@marandaneto
marandaneto requested a review from a team August 25, 2026 14:19
@posthog

posthog Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦔 ReviewHog reviewed this pull request

Found 0 must fix, 2 should fix, 0 consider.

Published 2 findings (view the review).

@posthog

posthog Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

ReviewHog Alpha 🦔 If you find any issues helpful - please reply "valid", "invalid", etc., for evaluation purposes 🙏

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewHog Report

Found 2 should fix.

Comment thread .changeset/model-capture-option.md Outdated
'@posthog/mcp': minor
---

Add opt-in `captureModel` option: injects a required `llm_model` parameter into every tool so the calling agent self-reports the model it runs as, captured as `$mcp_llm_model` with `$mcp_llm_model_source = "self_reported"`. The argument is stripped before the tool handler runs, a customer-declared `llm_model` parameter is never stolen or captured, and an honest `"unknown"` from the agent is dropped rather than recorded.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document the ownership limit for stateless server instances

should_fix

Why we think it's a valid issue
  • Checked: the ownership resolution path for llm_modelgetActiveAnalyticsParameterOwnership in packages/mcp/src/extensions/instrumentation.ts, the strip helper stripOwnedAnalyticsArguments in packages/mcp/src/extensions/analytics-parameters.ts, the capture call site, and the README section that already documents the same limit for context.
  • Found: packages/mcp/src/extensions/instrumentation.ts:183-189 resolves ownership as override ?? listed, where listed comes from data.toolAnalyticsParameterOwnership — a map that only tools/list fills (cacheToolAnalyticsParameterOwnership, same file, line 659). When neither source answers, llmModel is false.
  • Found: both effects the release note promises hang on that flag. packages/mcp/src/extensions/instrumentation.ts:278-279 calls setEventModel only if (ownership.llmModel), and stripOwnedAnalyticsArguments removes llm_model only under the same flag. So the premise holds: with ownership unresolved, the SDK does not capture the model and does not strip the argument.
  • Found: the code comment at packages/mcp/src/extensions/instrumentation.ts:274-277 states this choice is deliberate, and contrasts it with intent. Intent still captures when ownership is unresolved (ownership.context || !ownership.contextOwnershipKnown, line 126). The two options therefore degrade differently, and only the context degradation is documented (packages/mcp/README.md:125-133).
  • Found: this PR touches no documentation except the changeset. git diff lists 12 files and packages/mcp/README.md is not among them. A repo-wide grep finds captureModel only in the changeset and in the types.ts JSDoc, and neither text mentions the ownership condition.
  • Impact: on a host where ownership never resolves, an operator who enables captureModel pays the extra token on every tool call and records no $mcp_llm_model at all. The failure is silent and fail-safe — no wrong value, no stolen parameter — but nothing tells the operator why the property is empty.
  • Priority: lowered to consider. Three facts reduce the weight. First, the target file is a changeset, which is a one-paragraph release note; caveats of this depth normally belong in the README, and the finding's own suggestion points there. Second, the high-level path already resolves ownership per request from the live registry — packages/mcp/src/extensions/instrument-highlevel.ts:267-269 passes parameterOwnership built from _registeredTools[toolName] — so instrument(McpServer) strips and captures even on a fresh instance, and the affected surface is narrower than the finding states. Third, nothing breaks: the consequence is missing data, not wrong data or a failed call.
Issue description

The release note says the SDK strips and captures llm_model. This is not always true. A new server instance can handle tools/call without the ownership data from tools/list. The implementation then keeps the argument and does not capture the model. The current text can give operators false coverage expectations.

Suggested fix

State that stripping and capture require confirmed SDK ownership. Document the per-request instance limit, as the README already does for context. Explain which server configurations preserve ownership between tools/list and tools/call.

Prompt to fix with AI (copy-paste)
## Context
@.changeset/model-capture-option.md#L5

<issue_description>
The release note says the SDK strips and captures `llm_model`. This is not always true. A new server instance can handle `tools/call` without the ownership data from `tools/list`. The implementation then keeps the argument and does not capture the model. The current text can give operators false coverage expectations.
</issue_description>

<issue_validation>
- **Checked:** the ownership resolution path for `llm_model` — `getActiveAnalyticsParameterOwnership` in `packages/mcp/src/extensions/instrumentation.ts`, the strip helper `stripOwnedAnalyticsArguments` in `packages/mcp/src/extensions/analytics-parameters.ts`, the capture call site, and the README section that already documents the same limit for `context`.
- **Found:** `packages/mcp/src/extensions/instrumentation.ts:183-189` resolves ownership as `override ?? listed`, where `listed` comes from `data.toolAnalyticsParameterOwnership` — a map that only `tools/list` fills (`cacheToolAnalyticsParameterOwnership`, same file, line 659). When neither source answers, `llmModel` is `false`.
- **Found:** both effects the release note promises hang on that flag. `packages/mcp/src/extensions/instrumentation.ts:278-279` calls `setEventModel` only `if (ownership.llmModel)`, and `stripOwnedAnalyticsArguments` removes `llm_model` only under the same flag. So the premise holds: with ownership unresolved, the SDK does not capture the model and does not strip the argument.
- **Found:** the code comment at `packages/mcp/src/extensions/instrumentation.ts:274-277` states this choice is deliberate, and contrasts it with intent. Intent still captures when ownership is unresolved (`ownership.context || !ownership.contextOwnershipKnown`, line 126). The two options therefore degrade differently, and only the `context` degradation is documented (`packages/mcp/README.md:125-133`).
- **Found:** this PR touches no documentation except the changeset. `git diff` lists 12 files and `packages/mcp/README.md` is not among them. A repo-wide grep finds `captureModel` only in the changeset and in the `types.ts` JSDoc, and neither text mentions the ownership condition.
- **Impact:** on a host where ownership never resolves, an operator who enables `captureModel` pays the extra token on every tool call and records no `$mcp_llm_model` at all. The failure is silent and fail-safe — no wrong value, no stolen parameter — but nothing tells the operator why the property is empty.
- **Priority:** lowered to `consider`. Three facts reduce the weight. First, the target file is a changeset, which is a one-paragraph release note; caveats of this depth normally belong in the README, and the finding's own suggestion points there. Second, the high-level path already resolves ownership per request from the live registry — `packages/mcp/src/extensions/instrument-highlevel.ts:267-269` passes `parameterOwnership` built from `_registeredTools[toolName]` — so `instrument(McpServer)` strips and captures even on a fresh instance, and the affected surface is narrower than the finding states. Third, nothing breaks: the consequence is missing data, not wrong data or a failed call.
</issue_validation>

## Task
Investigate the issue and solve it

<potential_solution>
State that stripping and capture require confirmed SDK ownership. Document the per-request instance limit, as the README already does for `context`. Explain which server configurations preserve ownership between `tools/list` and `tools/call`.
</potential_solution>

Comment thread packages/mcp/src/types.ts
Comment on lines +132 to +145
/**
* Inject a required `llm_model` parameter on every tool so the calling agent
* self-reports the model it runs as, captured as `$mcp_llm_model` with
* `$mcp_llm_model_source = "self_reported"`. Off by default.
*
* The MCP wire deliberately carries no model identity, so self-report is the
* only capture path — harnesses inject the model id into the agent's system
* prompt, and agents restate it accurately. Like `clientInfo` in the MCP
* spec, the value is unverified: use it for per-model quality analytics, not
* billing or security. An honest `"unknown"` from the agent is dropped
* rather than captured. Reasoning effort is intentionally not collected —
* agents don't reliably know it, so it would only ever be noise.
*/
captureModel?: boolean | MCPAnalyticsModelOptions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add captureModel to the user documentation and event catalog

should_fix

Why we think it's a valid issue
  • Checked: every documentation artifact in the package — packages/mcp/README.md in full, packages/mcp/docs/ARCHITECTURE.md section by section, and the docs/adr/ set — against the new public surface the PR adds (captureModel on MCPAnalyticsOptions, and the LlmModel / LlmModelSource wire keys written in packages/mcp/src/extensions/posthog-events.ts:173-180).
  • Found: the finding names the wrong file. packages/mcp/README.md holds no options table, no event catalog, and no property catalog. It is 190 lines of deployment gotchas plus a local-development guide, and lines 3-5 state that usage examples live in the official docs at https://posthog.com/docs/mcp-analytics. So the claim that JavaScript users cannot discover the option "from the main package documentation" misreads what that README is for.
  • Found: the three artifacts the finding describes do exist, in packages/mcp/docs/ARCHITECTURE.md — §5 Event catalog (line 99), §6 Property catalog (line 117), §7 Customer extension points (line 163). The PR changes 12 files and none of them is a documentation file, so all three go stale on merge.
  • Found: those catalogs are actively maintained, not stale boilerplate. §6 opens with "All wire keys live in PostHogMCPAnalyticsProperty" and then enumerates every one, including the newest additions $mcp_client_user_agent, $mcp_vendor_client, and $mcp_protocol_version. Adding $mcp_llm_model and $mcp_llm_model_source without a row makes that opening sentence false.
  • Found: the closest precedent is already documented in exactly the shape the finding asks for. The ConversationId row in §6 reads "Optional; set when enableConversationId: true and the SDK owns the tool's injected conversation_id parameter", and §7 lists enableConversationId with its false default. captureModel is the same kind of opt-in, ownership-gated injected parameter and has neither entry.
  • Impact: confirmed drift in the package's own reference documentation. An analyst who sees $mcp_llm_model in PostHog finds no entry for it, and a reader of the options table sees no captureModel. The fix is mechanical: one row in §7 and two in §6.
  • Priority: lowered to consider. The verified impact is internal reference drift with no behavioral consequence, and the user-facing half of the stated impact does not hold — the package README deliberately defers the user manual to posthog.com, which lives outside this repo. Anyone acting on this should edit packages/mcp/docs/ARCHITECTURE.md, not the README.
Issue description

The new public option appears only in TypeScript API comments and the changeset. The README has an options table, an event catalog, and a property catalog. None describe captureModel, $mcp_llm_model, or $mcp_llm_model_source. JavaScript users and operators cannot discover the option or understand the emitted data from the main package documentation.

Suggested fix

Add captureModel to the README options table with its default and object form. Add both properties to the event and property catalogs. Explain that the value is self-reported, unverified, optional, and unavailable when ownership cannot be confirmed.

Prompt to fix with AI (copy-paste)
## Context
@packages/mcp/src/types.ts#L132-145

<issue_description>
The new public option appears only in TypeScript API comments and the changeset. The README has an options table, an event catalog, and a property catalog. None describe `captureModel`, `$mcp_llm_model`, or `$mcp_llm_model_source`. JavaScript users and operators cannot discover the option or understand the emitted data from the main package documentation.
</issue_description>

<issue_validation>
- **Checked:** every documentation artifact in the package — `packages/mcp/README.md` in full, `packages/mcp/docs/ARCHITECTURE.md` section by section, and the `docs/adr/` set — against the new public surface the PR adds (`captureModel` on `MCPAnalyticsOptions`, and the `LlmModel` / `LlmModelSource` wire keys written in `packages/mcp/src/extensions/posthog-events.ts:173-180`).
- **Found:** the finding names the wrong file. `packages/mcp/README.md` holds no options table, no event catalog, and no property catalog. It is 190 lines of deployment gotchas plus a local-development guide, and lines 3-5 state that usage examples live in the official docs at `https://posthog.com/docs/mcp-analytics`. So the claim that JavaScript users cannot discover the option "from the main package documentation" misreads what that README is for.
- **Found:** the three artifacts the finding describes do exist, in `packages/mcp/docs/ARCHITECTURE.md` — §5 Event catalog (line 99), §6 Property catalog (line 117), §7 Customer extension points (line 163). The PR changes 12 files and none of them is a documentation file, so all three go stale on merge.
- **Found:** those catalogs are actively maintained, not stale boilerplate. §6 opens with "All wire keys live in `PostHogMCPAnalyticsProperty`" and then enumerates every one, including the newest additions `$mcp_client_user_agent`, `$mcp_vendor_client`, and `$mcp_protocol_version`. Adding `$mcp_llm_model` and `$mcp_llm_model_source` without a row makes that opening sentence false.
- **Found:** the closest precedent is already documented in exactly the shape the finding asks for. The `ConversationId` row in §6 reads "Optional; set when `enableConversationId: true` and the SDK owns the tool's injected `conversation_id` parameter", and §7 lists `enableConversationId` with its `false` default. `captureModel` is the same kind of opt-in, ownership-gated injected parameter and has neither entry.
- **Impact:** confirmed drift in the package's own reference documentation. An analyst who sees `$mcp_llm_model` in PostHog finds no entry for it, and a reader of the options table sees no `captureModel`. The fix is mechanical: one row in §7 and two in §6.
- **Priority:** lowered to `consider`. The verified impact is internal reference drift with no behavioral consequence, and the user-facing half of the stated impact does not hold — the package README deliberately defers the user manual to posthog.com, which lives outside this repo. Anyone acting on this should edit `packages/mcp/docs/ARCHITECTURE.md`, not the README.
</issue_validation>

## Task
Investigate the issue and solve it

<potential_solution>
Add `captureModel` to the README options table with its default and object form. Add both properties to the event and property catalogs. Explain that the value is self-reported, unverified, optional, and unavailable when ownership cannot be confirmed.
</potential_solution>

… injector, document captureModel

Addresses review feedback on #4633.

Blocking: model injection ran before reportMissing appended get_more_tools, so with both options on the advertised virtual tool had no llm_model and its missing-capability reports could never self-report a model — the one call type silently missing the property. Injection now runs after the append. Ownership is still cached from the un-injected descriptor, and context stays excluded because the virtual tool declares its own.

Suggestion: addModelParameterToTool duplicated addContextParameterToTool almost verbatim. Both now delegate to a shared addAnalyticsParameterToTool in analytics-parameters.ts, so schema ownership, cloning, and required-field handling cannot drift.

Docs: README gains a captureModel section covering the ownership limit (it degrades to silence, unlike context, and the high-level path resolves ownership per request from the registry); ARCHITECTURE gains the §5/§6/§7 entries for captureModel, $mcp_llm_model, and $mcp_llm_model_source; the changeset no longer promises unconditional stripping and capture.

Generated-By: PostHog Desktop
Task-Id: 44c7be3e-4938-4f9a-bb80-89fd9d74db6d

Copy link
Copy Markdown
Contributor Author

Both review comments and both ReviewHog findings were valid. Fixed in a960d92.

Virtual tool missing llm_model (blocking). Model injection ran before reportMissing appended get_more_tools, so the virtual tool's advertised schema never carried the parameter. Ownership was still cached for it, meaning the SDK would strip and capture an llm_model argument it had never asked for, and missing capability reports were the one call type structurally unable to self report a model. Injection now runs after the append, mirroring how conversation_id already behaved. Ownership is still resolved from the un-injected descriptor, and context stays excluded because the virtual tool declares its own and that argument is the report itself.

Duplicated injection logic (suggestion). addModelParameterToTool was a near verbatim copy of addContextParameterToTool. Both now delegate to a shared addAnalyticsParameterToTool in analytics-parameters.ts, which already owned the ownership predicates, so schema cloning, additionalProperties handling, and required field behaviour cannot drift between the two parameters. Warning strings are unchanged.

Undocumented ownership limit. Worth flagging that captureModel degrades differently from context: context still records when ownership is unresolved, this captures nothing at all. I confirmed the high level path is unaffected, since instrument-highlevel.ts builds ownership per request from _registeredTools, so the limit is specific to a low level Server on fresh instance per request hosts. Documented in the README beside the existing $mcp_intent section, and the changeset no longer promises unconditional stripping and capture.

Stale reference docs. Added the $mcp_tool_call extras, the two property rows for $mcp_llm_model and $mcp_llm_model_source, and the captureModel options row in docs/ARCHITECTURE.md, following the existing ConversationId / enableConversationId precedent.

On verification: the package suites were initially failing to load in my environment because the workspace deps were unbuilt, so I took a stashed baseline first and confirmed the failures were identical with and without my changes before fixing the environment. Full suite is 46 suites and 667 tests passing, lint clean. I mutation tested the new regression test rather than trusting it: reverting only the reorder fails the schema assertion, restoring it passes. The second new test covers the missing capability capture path but passes either way, since capture keys off cached ownership rather than the advertised schema, so the schema assertion is the actual guard.

One deliberate omission: both markdown files were already non conforming to Prettier at HEAD and the package lint script only covers src and harness, so I left them alone rather than bury these fixes in an unrelated reformat.

@DanielVisca
DanielVisca requested a review from pauldambra August 25, 2026 17:37

@dustinbyrne dustinbyrne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agent-led review, human-reviewed before posting.

const cleanedArgs = stripOwnedAnalyticsArguments(args, {
context: isContextEnabled(options?.context) && analyticsOwnsParameter(inputSchema, 'context'),
conversationId: options?.enableConversationId === true && analyticsOwnsParameter(inputSchema, 'conversation_id'),
llmModel: isCaptureModelEnabled(options?.captureModel) && analyticsOwnsParameter(inputSchema, 'llm_model'),

@dustinbyrne dustinbyrne Aug 25, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Does instrument(McpServer) support applications that create a new high-level server instance for each request?

The README appears to say that it does. Conceptually, an application can use this pattern:

async function handleRequest(request) {
  const server = createAndInstrumentServer()
  return handleWithServer(server, request)
}

A tools/list request creates Instance A. The later get_more_tools call creates Instance B. The two instances do not share the ownership map.

The virtual-tool branch returns before the registry-based parameterOwnership logic. Also, isToolAdvertised() does not fill the ownership cache. This appears to make ownership.llmModel false on Instance B. The SDK would then neither capture nor remove llm_model.

If this lifecycle is supported, should this branch pass ownership from the virtual-tool descriptor? A test with separate list and call instances could verify the behavior.

This was the only potential gap found during our agent-assisted human review.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed, and reproduced with the test you suggested: separate advertising and calling instances, $mcp_llm_model came back undefined. Fixed in 6c10c1b.

That branch only runs when isToolAdvertised() returns false, so the descriptor is the SDK's own getReportMissingToolDescriptor(). Ownership is knowable statically there and we simply weren't consulting it. The fail-closed rule for registered tools exists because an unresolved llm_model may be the application's own argument, which cannot be the case when the application has no tool by that name. So the fix resolves ownership from the descriptor rather than relaxing the policy.

The low-level adapter had the same gap, so both now go through one shared helper. Each adapter has a test with separate list and call instances, and I checked they fail without the fix.

Scoped to llm_model on purpose. conversation_id still resolves from the cache: resolving it statically starts minting handles and appending prompt-back blocks on instances that mint none today, which is a session anchoring change (ADR-0004) rather than this gap, and it broke the existing fresh-instance test. Worth its own PR. context is already forced off for this event type and outputInstructions reads the cache directly, so llm_model is the only value that moves.

Also corrected the README line that prompted the question. It credited the live registry, which never covered the virtual tool.

@dustinbyrne
dustinbyrne requested a review from a team August 25, 2026 19:16
…list cache

The missing-capability branch called captureToolCall with no parameterOwnership, so ownership fell back to the per-instance tools/list cache. On a per-request server instance (the topology in ADR-0011) that cache is empty, so a get_more_tools call handled by an instance that never served a listing neither captured $mcp_llm_model nor stripped the injected llm_model argument.

That branch is only entered when the application does not advertise a tool by this name, so the descriptor is the SDK's own and what it declares is known statically — the fail-closed rationale for registered tools (the value might be the application's own argument) cannot apply. Resolve ownership from the descriptor instead, via a shared helper used by both the high-level and low-level adapters, which had the same gap.

conversation_id deliberately still reads from the cache: resolving it statically would start minting a handle, and appending its prompt-back block, on instances that today mint none — a change to session anchoring (ADR-0004) rather than to model capture.

Tests cover both adapters with separate advertising and calling instances, and the README no longer implies the live registry covers the virtual tool.

Generated-By: PostHog Desktop
Task-Id: 44c7be3e-4938-4f9a-bb80-89fd9d74db6d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants