TracingToolCallInterceptor
Rasuvaeff\Yii3McpTelemetryBridge\TracingToolCallInterceptor
Class — Rasuvaeff\Yii3McpTelemetryBridge — Source
Wraps every MCP tools/call in a mcp.tool <name> span: the tool name, masked arguments, the client identity (endpoint secret id and initialize handshake info), the session id and — when the session budget is configured — how many calls remain.
Arguments are recorded as one scalar attribute per argument (mcp.tool.argument.<name>), masked, stringified and truncated — the OTel attribute model only accepts primitives and homogeneous lists of primitives, so a single nested-array attribute would be dropped by the OTel backend (same flattening the ecosystem's OtelMiddleware uses for http.request.param.<name>).
The span follows the frozen trace() contract of rasuvaeff/yii3-telemetry: a tool exception is recorded on the span, the span status becomes Error and the ORIGINAL exception is rethrown, so the MCP error envelope the agent sees is unchanged. The mcp.outcome attribute follows the core's shared CallOutcome vocabulary: success, rejected (a client-visible refusal — rate limit, RBAC, budget) or error (an unexpected failure).
Methods
intercept()
intercept(Interceptor\ToolCallContext $context, callable $next): mixed