Skip to content

@W-21740433 - Add PFT telemetry support for Code Analyzer MCP tools#430

Open
aruntyagiTutu wants to merge 5 commits intomainfrom
feat/code-analyzer-pft-telemetry
Open

@W-21740433 - Add PFT telemetry support for Code Analyzer MCP tools#430
aruntyagiTutu wants to merge 5 commits intomainfrom
feat/code-analyzer-pft-telemetry

Conversation

@aruntyagiTutu
Copy link
Copy Markdown
Contributor

Summary

Implements Product Feedback Telemetry (PFT) for all Code Analyzer MCP tools following the pattern established in PR #397.

Changes

1. Updated TelemetryService Interface

File: packages/mcp-provider-api/src/services.ts

  • Added sendPdpEvent() method to TelemetryService interface
  • Added PdpEvent type definition with fields: eventName, productFeatureId, componentId, eventVolume

2. Centralized Product Feature ID

File: packages/mcp-provider-code-analyzer/src/constants.ts

  • Added CODE_ANALYZER_PRODUCT_FEATURE_ID = "aJCEE0000000mDK4AY"
  • Single source of truth for Code Analyzer product feature ID

3. Implemented PFT Events in All 6 Tools

Added sendPdpEvent() calls after successful tool execution:

Tool Event Name Component ID
run_code_analyzer codeAnalyzer.run run_code_analyzer
query_code_analyzer_results codeAnalyzer.query query_code_analyzer_results
list_code_analyzer_rules codeAnalyzer.listRules list_code_analyzer_rules
describe_code_analyzer_rule codeAnalyzer.describeRule describe_code_analyzer_rule
create_custom_rule codeAnalyzer.createCustomRule create_custom_rule
generate_xpath_prompt codeAnalyzer.generateXpathPrompt get_ast_nodes_to_generate_xpath

Adds Product Feedback Telemetry (PFT) support to all Code Analyzer MCP tools following the pattern established in PR #397.

Changes:
- Updated TelemetryService interface to include sendPdpEvent() method with PdpEvent type
- Added PFT events to all 6 Code Analyzer tools after successful execution:
  * run_code_analyzer (codeAnalyzer.run)
  * query_code_analyzer_results (codeAnalyzer.query)
  * list_code_analyzer_rules (codeAnalyzer.listRules)
  * describe_code_analyzer_rule (codeAnalyzer.describeRule)
  * create_custom_rule (codeAnalyzer.createCustomRule)
  * generate_xpath_prompt (codeAnalyzer.generateXpathPrompt)

Each PFT event includes:
- eventName: Descriptive event name for analytics
- productFeatureId: aJCEE0000007Uiv4AE (placeholder - TODO: Get specific Code Analyzer ID)
- componentId: Tool name for tracking individual tool usage

This enables product analytics tracking for Code Analyzer tool adoption and usage patterns.
- Define CODE_ANALYZER_PRODUCT_FEATURE_ID constant in constants.ts
- Replace all hardcoded product feature IDs with this constant
- Use correct Code Analyzer ID: aJCEE0000000mDK4AY

This ensures the product feature ID is defined in one place for easier
maintenance and updates.
@aruntyagiTutu aruntyagiTutu requested review from a team as code owners March 31, 2026 04:58
Updates TelemetryService interface to match the PdpEvent type definition
from @salesforce/telemetry package, ensuring type compatibility across
the MCP server and all provider packages.

Changes:
- Updated PdpEvent type in mcp-provider-api:
  * eventName: string → `${string}.${string}` (enforces "object.action" format)
  * productFeatureId: string → `aJC${string}` (enforces GUS Product Feature ID format)
  * componentId: string → optional string
- Added sendPdpEvent() method to NoopTelemetryService
- Exported PdpEvent type from mcp-provider-api index
- Updated mcp-provider-code-analyzer to use file:../mcp-provider-api for local development

This ensures all PFT telemetry calls use consistent type definitions that
match the @salesforce/telemetry TelemetryReporter implementation.
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.

1 participant