Skip to main content
Glama

Get Visitor Locations

get_visitor_locations
Read-onlyIdempotent

Where your site's visitors were over a period, by country, from your PostHog project: the Performance page's Visitors tab. A visitor is a PostHog person; countries are every located country, most visitors first, each with its ISO alpha-2 code, name, visitors, estimated and pageviews. Cookieless visitors (cookieless mode, where PostHog drops the IP) are placed by browser time zone, and estimated counts them; the rest of a country's visitors were placed by GeoIP. unknown counts visitors with no place (GeoIP off, a reverse proxy that hides visitor IPs, or a cookieless visitor whose time zone has no country, such as UTC); unknown.cookieless is the cookieless visitors with no placeable zone. total sums the rows, so someone seen in two countries counts twice; total.estimated sums the countries' estimated. Page loads by Cookiebot's consent scanner (browser language en-US@posix) are left out. state is ready, no-posthog (not connected), no-signal (PostHog has received no events yet) or failed, with reason: busy means PostHog didn't answer in time (it runs 3 queries at once per project and queues the rest), so try again in a minute; the PostHog connection is fine. error is any other failure, such as lost access, so check the PostHog connection. source ai_referral keeps only visits opened from an AI assistant's answer (ChatGPT, Perplexity, Claude, Gemini, Copilot and others), matched by referring domain or utm_source: the AI referrals card on the AI assistants tab. It is a floor: assistant clicks that arrive with no referrer and no utm_source can't be counted. Rank AI referrals by visitors, not pageviews: on a single-page site every pageview of the visit keeps the AI referrer, on a multi-page site only the first does. Does not change anything. Related: get_ai_visibility, get_content_performance, get_setup_status.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "get_visitor_locations"
  }
}

Input Schema

NameRequiredDescriptionDefault
toNoRange end YYYY-MM-DD.
fromNoRange start YYYY-MM-DD. Defaults to the last 28 settled days.
sourceNoall (default): every visit. ai_referral: only visits from an AI assistant's answer.

Output Schema

NameRequiredDescriptionDefault
toYes
fromYes
appUrlYes
visitorsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / source
      Added value: +{
      +  "description": "all (default): every visit. ai_referral: only visits from an AI assistant's answer.",
      +  "enum": [
      +    "all",
      +    "ai_referral"
      +  ],
      +  "type": "string"
      +}
  2. Added

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already declare read-only, idempotent, non-destructive, closed-world behavior, and the description still adds substantial operational context: the meaning of each state value, that 'busy' means PostHog timed out and a retry in a minute is appropriate, that 'error' points at a broken connection, and that Cookiebot scanner hits are excluded. It also discloses non-obvious counting semantics (cookieless placement by time zone, double counting in total, the AI-referral floor and the single-page vs multi-page pageview caveat) that an agent cannot infer from annotations.

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

Conciseness3/5

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

The opening clause is well front-loaded and almost every sentence carries real information, but the body is a single dense run-on stitched together with semicolons, making it hard to scan for the state/error guidance an agent most needs at call time. Structure, not content, is the weakness.

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 an output schema present, annotations covering the safety profile, and full parameter documentation, the description only needs to supply semantics and failure modes — which it does thoroughly, including state values, retry advice, and data-quality caveats. Nothing an agent needs to call it correctly is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3; the description goes beyond it by defining what ai_referral actually matches (referring domain or utm_source from named assistants) and warning that it is a floor and should be ranked by visitors rather than pageviews. Date parameters gain little beyond the schema's 'last 28 settled days' default, which keeps it from a 5.

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?

States a specific verb and resource ('Where your site's visitors were over a period, by country, from your PostHog project') and anchors it to a concrete UI surface (the Performance page's Visitors tab). The scope, grain, and sorting ('most visitors first') let an agent distinguish it from get_ai_visibility or get_content_performance 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 Guidelines4/5

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

Gives clear context for when to reach for it (country-level visitor breakdown over a date range) and names related tools at the end, plus indicates that source=ai_referral maps to the AI assistants tab's referrals card. It stops short of explicit when-not or 'use X instead when Y' routing between those siblings.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources