MCP Analytics event reference

このページはまだあなたの言語に翻訳されていません。 現在取り組んでいますので、後でもう一度確認してください。

早期アクセス

この機能は早期アクセスです。 この期間中、機能のさまざまな側面はまだ開発されている可能性があり、このドキュメントは常に最新であるとは限りません。 ご質問がある場合は、までお問い合わせください。Amplitude Support.

The Amplitude MCP Analytics SDK sends six events to your Amplitude project. This page lists when each one fires and the properties it carries. For what MCP Analytics does and how to set it up, go to MCP Analytics.

Every default event name and every SDK-derived property carries the [MCP] prefix. The prefix prevents collisions with events and properties that other Amplitude SDKs send to the same project. The events arrive through the standard Amplitude client, so they behave like any other event in your project.

Events the SDK sends

The autocaptured events need the SDK bound to your server before you connect the server. If you wrap a tool on an unbound server, the wrapper is a no-op passthrough: the handler runs untouched, and the SDK emits nothing and logs a one-time warning.

The SDK is best-effort and never throws. It catches and logs its own failures, so an SDK failure can't break a handler, a tools/list response, or a connection. When a handler throws, the SDK emits the failure event first and then re-throws to the MCP SDK.

Session events depend on the transport. On protocol revision 2025-11-25 and earlier, a stateless Streamable HTTP server still performs the handshake, so [MCP] Session Initialized fires with a [MCP] Session ID of no-session. Protocol revision 2026-07-28 removes the handshake, so neither session event fires there. [MCP] Session Ended never fires for a transport built per request, because the connection starts and ends inside one request. The other four events fire on every transport and every revision.

Identity on every event

Alongside event_properties, every event carries the standard Amplitude identity fields. The SDK resolves those fields per request through a fixed chain, and the first match wins.

At level 4, user_id is the synthetic key <anchor type>:<anchor value>. At level 5, it's anonymous:<device id>. When you supply a user_id without a device_id, the SDK derives a stable device_id from the anchor so calls in the same session, process, or trace correlate.

The SDK sends a tenant to Amplitude groups, not to an event property.

The SDK drops an event when the identity resolved to the anonymous floor and the event carries no tenant, rather than emitting noise. In practice, this rule affects only stateless Streamable HTTP requests with no identity configured and no trace context propagated.

Correlation anchor

The anchor is the per-request correlation key the SDK derives from the transport. It feeds [MCP] Anchor Type, [MCP] Session ID, and the synthetic identity floor. The SDK never fabricates a session id.

Shared properties

These SDK-derived properties appear on every event, including the custom events you send through the SDK.

Enrichment values you attach at server scope appear on every event. Values you attach at tool scope appear on the tool-scope events.

[MCP] Session Initialized

[MCP] Session Initialized marks the start of a protocol session. It fires when the MCP initialize request succeeds. At that moment, the SDK also captures the client's identifying information.

This event carries the shared properties and your server-scope enrichment values. It has no event-specific properties.

[MCP] Session Ended

[MCP] Session Ended marks the end of a protocol session. It fires when the transport closes, but only under two conditions: [MCP] Session Initialized fired for that connection first, and the transport outlived the request that opened it.

[MCP] Tools Listed

[MCP] Tools Listed reports each tools/list request the server serves, with the live tool set at call time. It fires when the handler returns or throws, and the handler's own behavior passes through untouched.

[MCP] Tool Call Response

[MCP] Tool Call Response is the default tool-execution event, one per call of an instrumented handler. It fires when the handler settles: returns, throws, or rejects. On failure, the SDK emits the event before it re-throws the error.

A call counts as a failure when the handler throws or rejects, or when it returns an in-band error result.

[MCP] Param Count is uncapped, and the SDK caps [MCP] Param Keys at 32. A count higher than the number of keys means the SDK omitted some keys.

[MCP] Tool Call Rejected

[MCP] Tool Call Rejected reports each tools/call request that fails before any tool callback runs. A request can fail before dispatch because the requested tool doesn't exist, because the tool is disabled, or because the arguments fail input-schema validation. No handler executes, so these calls would otherwise go unrecorded.

The attempted name is unvalidated caller input, so the SDK sends it as [MCP] Attempted Tool Name and never as [MCP] Tool Name, the key that per-tool dashboards slice on. Parameter capture doesn't run for this event, because rejected arguments are unvalidated.

One request never produces both this event and [MCP] Tool Call Response. A call that reached a tool callback reports on [MCP] Tool Call Response instead, even when the protocol layer fails after dispatch.

The MCP SDK raises the same error for every pre-dispatch failure, so all three causes arrive with the same error code and type. [MCP] Rejection Reason carries the cause structurally instead. It contains no caller data, so redaction never affects it. unrecognized is the deliberate fallback value for a cause the SDK can't establish. If unrecognized becomes more frequent after you upgrade the MCP SDK, check what changed upstream.

[MCP] Feedback Submitted

[MCP] Feedback Submitted fires when an agent calls the submit_feedback tool, which you register explicitly. It's the direct "did this help" signal: the agent reports what the user expressed, and the SDK doesn't infer feedback from any other tool's result.

This event doesn't pair with [MCP] Tool Call Response, and autocapture.toolCalls: false doesn't suppress the event. The event carries no conversation content.

Comment capture is off by default. Until you turn comment capture on, the field is absent from the tool schema, so the schema never requests free text from the agent.

Error classification

[MCP] Error Type is a closed set that the SDK assigns. Hosts never pick the value. The property appears on [MCP] Tool Call Response, [MCP] Tools Listed, and [MCP] Tool Call Rejected.

[MCP] Error Code is the finer-grained companion to [MCP] Error Type. The SDK emits the code only when a specific identifier is known: a code you supplied, a system error code, or a JSON-RPC code. The SDK omits the code for a bare thrown exception rather than echoing the type, so its presence means a specific known reason exists.

To attach a machine-readable code to an in-band error result and control the result's message, build the result with the SDK's tool-error helper. Describe the specific failure through that free-form code, not through the error type. The SDK emits the code as [MCP] Error Code.

Parameter capture

Shape capture is on by default. It reads only the handler's parsed, schema-validated argument object. It represents parameter values only by types, collection counts, and bucketed string lengths. Shape capture never walks nested content, and it never records parameter values.

The global exclusion list defaults to rationale and context. If you replace that list, include those names again when you still want them omitted.

Servers can opt in to richer capture for an individual tool:

  • Route values: A declared route key contributes a prefix to the shape, but only for a small schema enum. Don't declare a route key on a high-cardinality id field.
  • Derived facts: A tool can emit up to eight scalar [MCP] Param: <key> facts. The SDK drops string values longer than 256 characters, values containing @, quotes, or newlines, and non-finite numbers. A callback that throws or returns the wrong shape emits no facts and can't affect the handler.

Capture doesn't run on an unbound server, which preserves the no-op passthrough for a wrapped tool.

これは役に立ちましたか?

For AI agents: a documentation index is available at /docs/llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.

このページでは