Amplitude ACTION
Get Event Segmentation
Query event segmentation data (counts, uniques, and other metrics) for one or more events over a date range from the Amplitude Dashboard REST API. Use this to analyze how an event trends over time, optionally broken down by user properties. Example: call with
event={"event_type":"Purchase"}, startDate="20240706", endDate="20240805", metric="uniques" -> returns {data: {xValues: ["2024-07-06", ...], series: [[42, 51, ...]]}} (one value per day per requested series). See the documentation.- Action
- Read only
- API key
- SDK
- MCP
IMPLEMENTATION
Call this tool
Connect a user's Amplitude account once, then configure and run Get Event Segmentation from your backend or agent.
import { PipedreamClient } from "@pipedream/sdk"
const pd = new PipedreamClient({
projectId: process.env.PIPEDREAM_PROJECT_ID!,
clientId: process.env.PIPEDREAM_CLIENT_ID!,
clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
projectEnvironment: "production",
})
const result = await pd.actions.run({
id: "amplitude-get-event-segmentation",
externalUserId: "{external_user_id}", // any stable ID for this user in your system
configuredProps: {
amplitude: { authProvisionId: "apn_xxxxxxx" },
event: "Event",
startDate: "Start Date",
},
})
console.log(result)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "amplitude-get-event-segmentation",
"configured_props": {
"amplitude": { "authProvisionId": "apn_xxxxxxx" },
"event": "Event",
"startDate": "Start Date"
}
}'// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "amplitude",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
name: "amplitude-get-event-segmentation",
arguments: {
event: "Event",
startDate: "Start Date",
},
})SCHEMA
Inputs
Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.
| Property | Type | Description |
|---|---|---|
event Event | string | A single JSON-encoded event definition (the e param). event_type is required; filters and group_by are optional. Use a real event name from your project (e.g. Purchase, Sign Up), or Amplitude's built-in _active/_new events to query overall activity. Example: {"event_type":"_active"} (Amplitude's built-in "any active event" — do NOT use the literal string "Any Active Event", which is Amplitude UI label text, not a valid event_type value, and returns a 400). Required |
startDate Start Date | string | Start date, inclusive, in YYYYMMDD format (the start param). Example: 20240706. Required |
endDate End Date | string | End date, inclusive, in YYYYMMDD format (the end param). Example: 20240805. Required |
metric Metric | string | Metric to compute (the m param). One of: uniques, totals, pct_dau, average, histogram, sums, value_avg, formula. Defaults to uniques. Optional |
interval Interval | integer | Time interval (the i param). One of -300000 (realtime), -3600000 (hourly), 1 (daily), 7 (weekly), 30 (monthly). Defaults to 1. Optional |
segmentDefinitions Segment Definitions | string | JSON-encoded array of segment definitions (the s param). Example: [{"prop":"country","op":"is","values":["US"]}]. Optional |
groupBy Group By | string | A user or event property name to group results by (the g param). Optional |
groupBy2 Group By 2 | string | A second property name to group results by (the g2 param). Only used together with Group By. Optional |
secondEvent Second Event | string | A second JSON-encoded event definition (the e2 param) for a derived/comparison metric. Example: {"event_type":"Purchase"}. Optional |
limit Limit | integer | Maximum number of grouped values to return (the limit param). Min 1, max 1000. Defaults to 100. Amplitude has no cursor for this endpoint — values beyond this cap are silently dropped by the API, not just this tool. If more than limit distinct group-by values may exist, raise this toward 1000 or narrow with Segment Definitions/Group By. Optional |
formula Formula | string | Custom formula metric expression (the formula param). Required if Metric is set to formula. Example: UNIQUES(A)/UNIQUES(B). Optional |
REFERENCE
Tool details
Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.
- Registry key
- amplitude-get-event-segmentation
- Version
- 0.0.2
- App
- Amplitude
- Authentication
- API key
- Read-only
- Yes
- Destructive
- No
- Open world
- Yes
- Source
- View on GitHub ↗