Skip to main content
Glama
rakoo04

analytics-mcp-server

by rakoo04

Get Microsoft Clarity Insights

clarity_get_insights
Read-onlyIdempotent

Fetch Microsoft Clarity traffic and engagement metrics for a connected project, with optional breakdowns by up to 3 dimensions. Track sessions, engagement time, scroll depth, and errors over 1-3 days.

Instructions

Fetch Microsoft Clarity's traffic and engagement metrics (sessions, bots, engagement time, scroll depth, rage clicks, quick backs, dead clicks, script errors, and more) for a connected Clarity project, optionally broken down by up to 3 dimensions.

Note: Clarity connections authenticate with a per-project API token generated in the Clarity dashboard (Settings > Data Export), not OAuth — Clarity's Data Export API does not support OAuth. Each token is capped at 10 requests/day; this tool caches results for 1 hour to help stay under that limit.

Args:

  • connection (string): Name of a configured Clarity connection

  • num_of_days (1 | 2 | 3): How many trailing days of data to fetch (Clarity only supports 1-3)

  • dimensions (string[], optional): Up to 3 of: Browser, Device, Country, OS, Source, Medium, Campaign, Channel, URL, PageTitle. Omit for totals with no breakdown.

  • response_format ('markdown' | 'json'): Output format (default: 'markdown')

Returns raw per-metric breakdowns as reported by Clarity, e.g. one entry per metric name ("Traffic", "EngagementTime", "ScrollDepth", "DeadClickCount", ...) each with an "information" array of rows for the requested dimension breakdown.

Use when: "How is Clarity engagement trending by device over the last 3 days?" -> dimensions=["Device"] Don't use when: You need historical data beyond 3 days (Clarity's export API doesn't support that; use the Clarity dashboard/UI instead).

Error Handling:

  • Returns "Clarity API rate limit reached" if the project's 10-requests/day cap is hit; wait and retry, or reuse a cached result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionYes
dimensionsNo
num_of_daysNo
response_formatNomarkdown

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already carry readOnlyHint=true and idempotentHint=true, and the description adds substantial context beyond these: the per-project API-token auth model (explicitly noting Data Export API does not support OAuth), the 10-requests/day cap, 1-hour result caching, and the exact 'Clarity API rate limit reached' error string. The disclosed behavior is consistent with readOnlyHint (fetch-only, non-destructive), so no contradiction.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose is front-loaded and the body is organized into labeled sections (Args, Returns, Use when, Don't use when, Error Handling), making it skimmable for an agent. Minor redundancy: the 10-requests/day cap and caching are stated twice (in the auth note and implied in error handling). Slightly long but every section earns its place given the rate-limit stakes.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description appropriately documents the return shape (raw per-metric breakdowns with an 'information' array per metric name). It covers authentication prerequisites, rate limiting, caching, error behavior, parameter semantics, and usage boundaries. Nothing an agent needs to call this correctly is missing for a read-only metrics tool of this complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must carry the full burden, and it does: connection is explained as a 'configured' connection, num_of_days gains the constraint rationale ('Clarity only supports 1-3'), dimensions gains the critical semantic 'Omit for totals with no breakdown' beyond the bare enum, and response_format's default is surfaced. Slight redundancy in re-listing the dimensions enum, but the added meaning fully compensates for the absent schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb + resource ('Fetch Microsoft Clarity's traffic and engagement metrics... for a connected Clarity project') and enumerates the concrete metric types (sessions, rage clicks, dead clicks, script errors). This clearly distinguishes it from sibling analytics tools targeting different platforms (ga4_run_report, gsc_query_search_analytics), so an agent can route correctly without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides an explicit 'Use when' rule with a concrete example query mapped to a parameter value ("How is Clarity engagement trending by device over the last 3 days?" -> dimensions=['Device']), plus a 'Don't use when' exclusion naming the limitation (3-day API bound) and the fallback (Clarity dashboard/UI). This is exactly the routing guidance required.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.