Skip to content

feat: add MCP prompts for common GA4 workflows (closes #52)#144

Open
ZLeventer wants to merge 1 commit intogoogleanalytics:mainfrom
ZLeventer:feat/add-mcp-prompts
Open

feat: add MCP prompts for common GA4 workflows (closes #52)#144
ZLeventer wants to merge 1 commit intogoogleanalytics:mainfrom
ZLeventer:feat/add-mcp-prompts

Conversation

@ZLeventer
Copy link
Copy Markdown

Summary

Adds MCP Prompts to the server, closing #52. Prompts are exposed as slash commands in Gemini CLI and as pre-built prompts in Claude Desktop and other MCP clients.

Prompts added

Prompt Use case
traffic-summary Aggregate sessions, users, bounce rate, and engagement time for a date range
top-pages Top N pages by sessions with engagement metrics
acquisition-overview Traffic broken down by source / medium, grouped by channel
compare-periods Side-by-side metric comparison between two date ranges with % change
campaign-performance UTM-tagged campaigns ranked by conversions
realtime-overview Active users now by page, country, and device (three run_realtime_report calls)

All prompts accept property_id (required) and most accept an optional date_range argument.

Implementation

  • analytics_mcp/prompts.py (new) — prompt definitions (mcp_types.Prompt list) and text builders. Each builder returns a GetPromptResult with a user-role message that instructs the model which tools to call and how to present results.
  • analytics_mcp/coordinator.py — adds @app.list_prompts() and @app.get_prompt() handlers that delegate to prompts_module.
  • tests/prompts_test.py (new) — 16 unit tests covering list_prompts and get_prompt for every prompt, including default argument handling and unknown prompt error.
  • README.md — new Prompts section with a table of all prompts and their arguments.

Tests

16 passed in 0.34s

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