Skip to content

feat: add run_funnel_report tool using Data API v1alpha#127

Open
mderazon wants to merge 1 commit intogoogleanalytics:mainfrom
scheduleonce:main
Open

feat: add run_funnel_report tool using Data API v1alpha#127
mderazon wants to merge 1 commit intogoogleanalytics:mainfrom
scheduleonce:main

Conversation

@mderazon
Copy link
Copy Markdown

@mderazon mderazon commented Mar 27, 2026

Summary

This PR picks up and completes the work from #54 (originally authored by @cagnusmarlsen), which added a run_funnel_report tool. That PR stalled due to merge conflicts and inactivity. This PR rebases cleanly on current main and incorporates all reviewer feedback from the original PR.

Changes

  • analytics_mcp/tools/reporting/funnel.py (new file): run_funnel_report async function and its description builder _run_funnel_report_description()
  • analytics_mcp/tools/reporting/metadata.py: adds get_funnel_steps_hints() with 7 proto-generated step examples covering common funnel configurations
  • analytics_mcp/tools/utils.py: adds data_v1alpha import and create_data_api_alpha_client() factory function
  • analytics_mcp/coordinator.py: registers run_funnel_report as an ADK FunctionTool alongside the existing tools
  • README.md: documents the new tool

Differences from #54

  • Adapted to current architecture: the original PR used an mcp.add_tool() pattern that no longer exists. This PR uses the current ADK FunctionTool registration in coordinator.py.
  • Bug fix: the step_home_page_view example in get_funnel_steps_hints() now uses pageLocation with CONTAINS instead of pagePath with EXACT, which is not supported inside funnel steps (flagged by @testyuminliang in the original PR).
  • Null safety: date_ranges parameter now safely handles None default (was crashing previously).
  • Resolved merge conflicts: rebased cleanly on current main.

Tested this locally and it was working great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant