MCP Tools: Analytics and Introspection

A well-behaved MCP client does not guess. Before it writes a page it asks for the page schema; before it charts your traffic it asks which metrics exist; and when a call is refused it asks what the connection is actually allowed to do. This page covers the Operator MCP’s read tools for analytics and the workspace, plus one report. Know: get_know_view reads any Know view, run_saved_view and save_view run and save saved views, and get_gap, mark_gap_in_progress, dismiss_gap and reopen_gap work Search & gaps’ What to write next items. Single metrics: get_analytics and list_analytics_metrics. Activity and releases: get_contact_activity, list_release_runs, get_next_release_preview and get_deployment_timings. Introspection and context: describe_schema, describe_capabilities and get_company_overview. And report_blocked_request, which a client calls when Cloudflare’s firewall stops a request before it reaches Leed.

Most of these tools change nothing in your workspace. Five write: save_view saves a view, the three gap decisions (mark_gap_in_progress, dismiss_gap, reopen_gap) record a decision on a What to write next item, and report_blocked_request sends a report to Leed. None changes page content, and none publishes. Some views and tools need a plan (see each), and every read is clamped to your plan’s analytics history and contact limit.

Know

The Know tools return what the Know screens show, with the same filters and the same numbers. Reading Know from MCP and the CLI walks through them, and the Know views reference lists each view’s sections and filters.

get_know_view

GET /api/know/views/:view · Operator MCP and the assistant · read-only · requires analytics:read

ParameterTypeRequiredDefaultNotes
viewstringno—Omit to list every view with its filters, sections, flag, personSections and gatedSections.
startstring (ISO-8601 date-time)with view—There is no default window.
endstring (ISO-8601 date-time)with view—At most 365 days after start; clamped to your plan’s analytics history.
sectionsstringnoevery sectionComma-separated names of the view’s sections to return, such as traffic,referrers. Only those run, so the answer is smaller and faster. A name the view does not have is refused, and the error lists the view’s sections; the list call (no view) names each view’s sections.
Shared filtersvariousno—compare, pageTypeId, readers (everyone, people or agents), agentIdentity (any, signed in or anonymous), country, referrerHost, channel, account, journeyStage (a journeyId or none), signedInAgents, and others, passed as top-level arguments
View filtersvarioussome views—Each view’s own, such as contactId on person, accountId on account, pageId, release, groupBy, q, sort or logSource

A filter the view does not take is refused, and the error names the view’s filters. The response carries the window actually queried (after the retention clamp) and the view’s sections. On a view the plan does not include it returns gated: true with flag and totals and sections: null; a gated section inside an open view returns { gated: true, flag, total } with its real total. Both are successes, so do not retry them. Some combinations are refused outright: agentIdentity other than any with readers: "people", and an account filter with anonymous agents only. The old four journey stage values (awareness, consideration, evaluation, decision) are refused with a pointer to list_journey_stages. Agents are only ever signed in or anonymous; there is no breakdown by AI client.

save_view and run_saved_view

POST /api/know/saved-views and GET /api/know/saved-views/run/:id · Operator MCP and the assistant · requires analytics:read

save_view takes a name (at most 120 characters), the view, that view’s filters nested under filters (as for get_know_view), a dateMode (rolling with rollingDays, sinceLatestRelease, whose window moves with each release, or fixed with fixedStart and fixedEnd, at most 365 days apart), visibility (me, the default, or everyone in the company) and pinned (pin to the Know menu of everyone who can see it). It returns the saved view with its id.

run_saved_view with no id lists the saved views you can see, your own and everyone’s, each with its filters, date mode and the window it resolves to now. With an id it returns exactly what get_know_view returns for that view over that window, plus savedView: its name, date mode, window, and any saved filters that no longer apply. A view the plan does not include returns gated: true.

What to write next: get_gap, mark_gap_in_progress, dismiss_gap, reopen_gap

Operator MCP and the assistant · require analytics:read

The items come from get_know_view with view: "searchGaps", under sections.writeNext.items. Each has a kind (unanswered, rising_falling or shipped_unread) and a gapKey (the normalized question for unanswered, otherwise the page id).

ToolRouteWhat it does
get_gapGET /api/know/gaps/evidenceTakes kind, gapKey, the same start and end the item was listed over, and the Search & gaps filters. Returns the item as the list shows it (with dismissedReason when it was dismissed with one) plus its evidence: for a question, every spelling with its asks by source, the site search terms, what readers reworded it as, the pages read after asking, and counts of readers, people and accounts (inside your contact limit and history, nobody named); for the other kinds, the item’s own page; the linked draft; and nearestPages, your own search for the question. An item the window does not list is a 404.
mark_gap_in_progressPOST /api/know/gaps/in-progressLinks a page (pageId) and moves the item to In progress. Also needs page:create. Linking the same page again succeeds, so it is safe to retry.
dismiss_gapPOST /api/know/gaps/dismissTakes the item’s current count as questionCount and hides the item until that count doubles. An optional reason (at most 280 characters, trimmed) says why; it is shown under the item on the Dismissed tab and returned by get_know_view and get_gap.
reopen_gapPOST /api/know/gaps/reopenUndoes a dismissal or a link: the item returns to Open, any linked page is unlinked and left as it is, and a dismissal’s reason is cleared.

The flow the tool descriptions share: list the items, read one with get_gap, decide between a new page and a revision of an existing one, then either create it with create_page_from_markdown and its gap argument, or put the existing page into revision, edit it in suggest mode stamped with sourceId, and link it with mark_gap_in_progress. Never publish: a person reviews the draft, and the item closes on its own once the linked page is published. See Search & gaps.

Analytics

Two tools, and they are meant to be used in that order: discover the metric names, then query one.

get_analytics

GET /api/analytics · Operator MCP and the assistant · read-only · requires analytics:read

ParameterTypeRequiredDefaultNotes
metricstringyes—A metric name from list_analytics_metrics, which lists each with its required arguments, gating plan feature and privilege. Checked by the tool schema, so a misspelling fails before the call.
startstring (ISO-8601 date-time)yes—Start of the window.
endstring (ISO-8601 date-time)yes—End of the window. Must be strictly after start.
type"count" | "line"nobothNumber metrics only. count returns the single value, line the time series. Omit for both. Ignored by list metrics.
pageIdstringnosite-wideThe page’s internal id, never its title. Resolve a title through list_pages first.
assetIdstringfor video and audio play, pause and replay metrics—From list_assets; optional for the video and audio summary metrics and the document metrics
formIdstringno—formPerformanceByForm only: one form
limitinteger 1–100no—Rows per page for list and report metrics
offsetintegerno0Rows to skip

Returns the metric result: a value plus trend for a number metric, a ranked table for a list metric, the median, bands and distribution for readingDepth, and for a report metric (form, short link, share channel, email and email template performance) { metric, window, rows, total }, paged with limit and offset. Report metrics cannot be charted by the assistant. The two email reports need contact:read, and emailPerformanceByTemplate also needs Starter (readerIdentity; a 402 below it).

list_analytics_metrics

In-process · Operator MCP only · read-only · no arguments

Returns numberMetrics, listMetrics, summaryMetrics and reportMetrics, the arrays of valid metric values by kind, plus metrics: one entry per name with its kind, the arguments it requires and the optional ones it accepts (assetId, pageId, formId), the plan feature it needs (null for every plan), the privilege it needs beyond analytics:read, and namesPeople (always false: every metric is an aggregate). This is the only correct way to discover them. It has no backing HTTP route: the answer is a static catalog, so it is served in the MCP layer itself and never touches your data.

{
  "numberMetrics": ["pageViewsMetric", "uniqueVisitorsMetric", "…"],
  "listMetrics": ["browsersUsedMetric", "referrersMetric", "sessionsByCountryMetric", "…"],
  "summaryMetrics": ["readingDepth"],
  "reportMetrics": ["formPerformanceByForm", "shortLinkClicksByCode", "shortLinkShares", "emailPerformanceByEmail", "emailPerformanceByTemplate"],
  "metrics": [
    { "name": "pageViewsMetric", "kind": "number", "requires": [], "optional": ["pageId"], "feature": null, "privilege": null, "namesPeople": false },
    { "name": "videoPlayMetric", "kind": "list", "requires": ["assetId"], "optional": ["pageId"], "feature": "mediaEngagementAnalytics", "privilege": null, "namesPeople": false }
  ]
}

The four kinds of metric

KindCountWhat it returnsDoes type apply?
Number metrics8One counted value for the window, plus a time seriesYes — count, line, or both
List metrics23, plus elementClicks in metricsA ranked table of rowsNo
Summary metrics1 (readingDepth)One composite result: the median reading depth, the share of reads in four bands, a distribution in 10% steps, and the reads that could not be measuredNo
Report metrics5{ metric, window, rows, total }: aggregate rows per form, short link, share channel, email or email templateNo

The definitions belong with the analytics screens that display them, not here: the counted metrics are defined in the metrics reference, and the ranked tables, with their columns, in the list metrics reference. A metric means the same thing over MCP as it does in the CMS — there is one implementation behind both.

A handful of metrics are gated by plan rather than by MCP: the video and audio engagement metrics, the internal-click metrics, hidden-UTM inbound attribution and the short link reports are Growth features, and emailPerformanceByTemplate needs the readerIdentity entitlement — Starter and up, or a per-company override. Querying one without its entitlement returns a 402 with an upgrade_required body, which reaches your client as a tool error naming the feature. Which metric needs which plan is in list_analytics_metrics and in feature availability by plan; capture is never gated, only reporting, so the data is waiting when you upgrade.

Where your data stops

Analytics retention is a quota, not a feature switch. Free keeps 30 days, Starter 365, Growth 730, and Enterprise is unlimited. Nothing is ever deleted — retention is applied at query time as a cutoff.

That produces two different outcomes, and it is worth knowing which one you hit:

  • A window that straddles the cutoff is silently clamped. Ask a Free workspace for 90 days and you get the most recent 30, with no error and no warning. The response echoes the window that was actually queried, so read it rather than assuming your requested bounds.
  • A window entirely older than the cutoff is refused. You get a 402 with {"error":"upgrade_required","reason":"quota_exceeded","feature":"analyticsRetention"}, carrying your current tier, the retention quota in days, and how far back the request reached.

Date ranges and retention covers the same clamp from the dashboard’s side, where the date picker enforces it before you can ask.

MCP returns data, the assistant draws a chart

There are two analytics tools in Leed and they are deliberately not the same one. get_analytics returns rows for a model to reason over, over the Operator MCP and in the assistant. get_analytics_chart is assistant-only and renders a chart inline in the chat — a count, a line, a ranked list, or a US and world map for the two geographic metrics — for number and list metrics; report metrics cannot be charted. If you connected a client and cannot find a tool that draws pictures, that is why; ask the Leed Assistant instead.

Calls you make over the Operator MCP are not counted as reader traffic — analytics for AI and MCP clients explains how people and agents are counted.

Activity, releases and deployments

get_contact_activity

GET /api/leaddetails/:leadDetailsId/activity · Operator MCP and the assistant · read-only · needs the readerIdentity entitlement (Starter and up, or a per-company override)

ParameterTypeRequiredDefaultNotes
leadDetailsIdintegeryes—The contact, from list_engage_contacts
beforestringnonewestThe previous page’s nextCursor, for older sessions

Returns one contact’s sessions, newest first: the next ten in full (browser sessions with the pages viewed, reading depth, CTA clicks and form fills; Docs MCP sessions with the tool calls the agent made signed in and the pages each asked for) and one summary of everything older, as { leadDetailsId, sessions, older, nextCursor, totals, agentCallsGated }. It needs the readerIdentity entitlement — Starter and up, or a per-company override — and answers 403 with readerIdentityGated without it. Agent calls need the agentAnalytics entitlement (Growth and up, or a per-company override) and are left out of every figure with agentCallsGated: true without it. A contact over your plan’s visible-contact limit is a 404. Agents are reported as signed-in calls only, with no client breakdown.

list_release_runs and get_next_release_preview

GET /api/know/releases/:releaseId/runs and GET /api/know/release-runs/next · Operator MCP and the assistant · read-only

list_release_runs takes a releaseId and lists every schedule-by-source run for that release, newest first, dry runs included: its caller (an OIDC trust’s name or the person), the source ids it asked for (count, first, last), the counts it matched, scheduled, failed and left remaining, and per-page outcomes with skip reasons. get_next_release_preview takes no arguments and returns the latest dry run for a release that has not started yet: what the next release would publish, and which pages would fail and why. Its release is null when the run names a release not created yet, and its run is null when there is no dry run. Runs older than your plan’s analytics history are left out of both. Releases in Know shows the same runs on screen.

get_deployment_timings

GET /api/deployments/timings · Operator MCP and the assistant · read-only · requires deployment:read

Optional ISO-8601 start and end, defaulting to the last 30 days and at most 365 days apart. Returns build time (build triggered to build completed), time from publish to live (publish, by a person or the scheduler, to activated, succeeded deployments only) and failures, per deployment and rolled up per branch: staging for the preview site and main for the live site. Each summary gives the count, succeeded, failures, failure rate, and the median, p90, average, minimum and maximum in milliseconds, or null when nothing finished. Up to 200 deployments per branch come back, newest first, with truncated set when there were more. Deployments are not linked to releases: one deployment can carry several.

Introspection

Two tools with no backing HTTP route. They are answered in the MCP layer itself, are read-only, and are the same for every workspace — they describe shapes and catalogs, not your content. They are still recorded in the audit trail like any other call.

describe_schema

In-process · Operator MCP only · read-only

ParameterTypeRequiredDefaultNotes
target"page" | "page_type" | "form" | "menu" | "leed_markdown"yes—Which schema to return.

The first four targets return JSON Schema, so a model can construct a valid input for the matching create or update tool without trial and error. The fifth returns prose.

TargetReturnsCall it before
pageJSON Schema for a page inputreserve_page, create_page_from_markdown, update_page_metadata
page_typeJSON Schema for a page type inputcreate_page_type, update_page_type, or reasoning about a page type’s fields
formJSON Schema for a form inputcreate_form, update_form_draft
menuJSON Schema for a menu inputcreate_menu
leed_markdownThe full Leed Markdown syntax guide, as textWriting any page body

The leed_markdown target is worth calling out. It returns the same syntax guide the page-writing tools embed in their own descriptions and the same one authors read at the Leed Markdown cheat sheet — alerts, collapsibles, tabs, embeds, attribute syntax, the lot. A client that fetches it once writes markdown that survives the round trip through the editor. Authoring pages over MCP shows what that looks like in practice.

{
  "target": "leed_markdown",
  "guide": "# Leed Markdown Format\n\nAlerts:\n:::note\n…"
}

list_analytics_metrics

The second introspection tool, covered under Analytics above because that is where you will use it. It is listed here so the pair is not surprising: both are in-process, both are argument-light, and both are cheap enough to call at the start of every session.

Workspace context

Two tools that answer “what is this workspace, and what am I allowed to do in it”.

describe_capabilities

GET /api/ai/context/capabilities · Operator MCP and the assistant · read-only · requires rbac:read

No parameters. Returns your effective role, the full privilege list with the minimum role each one requires and whether you are granted it, and your resource-level overrides grouped by resource type.

{
  "role": "Write",
  "privileges": [
    { "privilege": "page:write", "minimumRole": "Write", "granted": true },
    { "privilege": "page:publish", "minimumRole": "Publish", "granted": false }
  ],
  "overrides": {
    "pagetype": [{ "resourceId": "u05nxr", "role": "Publish" }]
  }
}

The overrides matter as much as the role. A Content Writer with a Content Publisher override on one page type can publish there and nowhere else, and this tool is the only way a client can see that before it tries. The privilege matrix is the same grid in human form, and resource-level access overrides explains how one gets granted.

rbac:read itself requires the Read Only role or higher, so a Restricted user cannot call this tool — or get_analytics, which needs analytics:read on the same floor.

get_company_overview

GET /api/ai/context/company · Operator MCP only · read-only

No parameters. Returns a deliberately narrow summary of the workspace:

FieldMeaning
siteTitleThe site’s display title
public.domain / public.customDomainActiveYour live domain and whether the custom hostname is active
preview.domain / preview.customDomainActiveThe same for the preview site
tierThe entitlement tier: free, starter, growth or enterprise
languagesThe languages configured for API documentation code samples

It is a safe subset by design and does not expose provisioning internals — no DNS or DKIM records, no Cloudflare project ids, no Turnstile keys, no repository credentials. A client that wants to build a link to a published page combines this with resolve_path and list_paths, which live with the rest of the URL tools in MCP tools: site structure.

Reporting a blocked request

Cloudflare’s firewall sits in front of Leed and now and then mistakes legitimate content for an attack. When it does, the request never reaches Leed: the tool call comes back as a 403 with an HTML page (“Just a moment…” or “Attention Required”) or a cf-ray value, and no JSON error. That is not a permissions problem, and signing in again will not fix it.

report_blocked_request

POST /api/feedback/blocked-request · Operator MCP only · any signed-in role, Restricted included

ParameterTypeRequiredDefaultNotes
rayIdstringyes—The Cloudflare ray id from the cf-ray value, such as a405c2a089ca7ce0-ORD
commandstringyes—The tool name and its argument names written as name= with no values, such as update_page_body pageId= ops= mode=. Every other word after the tool name is treated as a value and dropped
occurredAtstring (ISO-8601)nothe time of the reportWhen the request was blocked
methodstringno—The HTTP method of the blocked request
pathstringno—Its URL path, without the query string
httpStatusintegerno—The status Cloudflare answered with
bodyBytesintegerno—The size of the blocked body
bodySha256stringno—The lowercase hex SHA-256 of the blocked body
excerptBase64stringno—At most the first 2 KB of the blocked body, base64-encoded
notestringno—What was being done, in at most 2,000 characters

Returns { feedback: { id, createdAt } }. Leed uses the ray id to find the firewall rule that fired and fix the false positive. Reports share the feedback limit of 30 per hour.

The tool is not offered to the Leed Assistant: the assistant calls Leed from inside the CMS and never passes through the firewall, so it has nothing to report. A client should retry a blocked write at most once, never reword or encode your content to get past the filter, and tell you what was blocked along with the ray id. The Leed CLI reports the same failure with leed feedback blocked.

ESC