grain.query, grain.segment.compare) are the identifiers that
the model sees. You rarely type them. The model picks the tool from your prompt.
Discovery: mcp:read
These tools describe what is in the tenant. They consume no query budget. An agent calls them
first on an unfamiliar tenant.
grain.events.list
Lists the distinct event names that the tenant has received, in alphabetical order.
An example prompt is “What events does my site track?”.
grain.dimensions.discover
Samples recent events and returns the dimensions (properties) that you can filter or group by,
with cardinality hints and redacted sample values.
An example prompt is “What can I break
signup down by?”.
grain.integration.status
Reports whether the Grain Tag sends data correctly. Call it before an investigation, so that you
know the data is complete.
An example prompt is “Is my tracking healthy?”.
Query: mcp:query
These tools wrap the Grain query engine with the same surprise detection that Kai uses in the
dashboard. A response includes structured hints (_surprises, _narrativeHints) about what is
concentrated, volatile, or changed in rank.
grain.query
Runs a breakdown or a time series query with filters and grouping.
An example prompt is “Signups by country last week, top 5.”.
grain.query.count
Returns the total count of events that match the filters in a window. It costs less than
grain.query when you do not need rows.
An example prompt is “How many signups did I get this week?”.
grain.query.compare
Runs the same query two times, for the current window and a previous window. It returns both
results and a comparison with deltas and percent changes.
An example prompt is “Traffic sources this week versus last week, flag anything that moved more
than 20%.”.
grain.query.digest
Writes an end-of-period digest: top metrics, biggest movers, and anomalies. This is the tool
behind a daily briefing.
An example prompt is “Give me yesterday’s digest.”.
Investigation: mcp:investigate
These tools answer “why did X happen” questions.
grain.correlate_event
Takes a target event and finds other events whose occurrence correlates with it above the
baseline. Use it for “what did users do before they converted” questions.
An example prompt is “What events do users fire in the 10 minutes before purchase_completed?”.
grain.track.analyze
Analyzes a Track, the Grain two-step funnel (a start event, then a goal event, in a time window).
It returns the conversion rate, the dimensions with the biggest drop-off, and a breakdown per
segment.
An example prompt is “How many visitors who hit
checkout_started finished with
purchase_completed within 30 minutes last week? Where did they drop off?”.
grain.segment.compare
Compares two cohorts, each defined by filters, on a metric. It returns the dimensions where the
cohorts differ most.
An example prompt is “Compare users who converted versus users who bounced on the pricing page.
What is different about them?”.
grain.sessions.cluster
Groups sessions by behavioral signature. It returns representative sessions for each cluster, so
an agent can summarize each cluster in one sentence.
An example prompt is “Cluster sessions from users who abandoned checkout yesterday.”.
Shared shapes
Every query tool uses the same two shapes.
A
TimeRange holds last, or from and to, not both.
The backend does not support the
in and contains operators. If an agent sends one,
grain.query rejects the call with an error.direct, organic, paid, social, email, and referral.
Read Automatic properties for the meaning of each property.
Budgets
Grain enforces a budget per MCP request, so that an agent cannot saturate the tenant.
If an agent reaches the budget in a session, it receives a structured error. The agent then asks
you to narrow the question. The tools wrap the same engine as the Query API. Read
Query API for the HTTP interface.