sanitizeToolNameForAnalytics function

AnalyticsVerifiedString sanitizeToolNameForAnalytics(
  1. String toolName
)

Sanitises tool names for analytics logging to avoid PII exposure.

MCP tool names follow the format mcp__<server>__<tool> and can reveal user-specific server configurations (PII-medium). This function redacts MCP tool names while preserving built-in tool names.

Implementation

AnalyticsVerifiedString sanitizeToolNameForAnalytics(String toolName) {
  if (toolName.startsWith('mcp__')) return 'mcp_tool';
  return toolName;
}