get_aggregate_data
Fetch aggregate analytics reports from AppsFlyer for specified date ranges and report types to analyze app performance data.
Instructions
Fetches aggregate data reports from the AppsFlyer Pull API.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes |
Implementation Reference
- appsflyer_mcp/server.py:36-66 (handler)The main execution logic for the get_aggregate_data tool. Decorated with @mcp.tool() for automatic registration and handling of the tool call. Fetches CSV aggregate reports from AppsFlyer API using provided parameters.@mcp.tool() async def get_aggregate_data(data: AggregateDataInput): """Fetches aggregate data reports from the AppsFlyer Pull API.""" if not AF_API_BASE_URL or not AF_TOKEN: return "Error: AppsFlyer API credentials not configured." # The specific endpoint for the AGGREGATE PULL API endpoint = f"{AF_API_BASE_URL}/api/agg-data/export/app/{data.app_id}/{data.report_type}/v5" params = { "from": data.from_date.isoformat(), "to": data.to_date.isoformat(), } headers = { "Authorization": f"Bearer {AF_TOKEN}", "Accept": "text/csv" } try: async with httpx.AsyncClient(timeout=30.0) as client: response = await client.get(endpoint, headers=headers, params=params) response.raise_for_status() return response.text except httpx.HTTPStatusError as e: return f"HTTP error occurred: {e.response.text}" except httpx.RequestError as e: return f"A network error occurred: {e}"
- appsflyer_mcp/server.py:23-34 (schema)Pydantic input model (schema) for validating parameters to the get_aggregate_data tool.class AggregateDataInput(BaseModel): app_id: str = Field(..., description="The ID of the AppsFlyer app.") from_date: date = Field(..., description="The start date of the data range (YYYY-MM-DD).") to_date: date = Field(..., description="The end date of the data range (YYYY-MM-DD).") report_type: Literal[ "partners_report", "partners_by_date_report", "daily_report", "geo_report", "geo_by_date_report" ] = Field("daily_report", description="The type of aggregate report to fetch.")
- appsflyer_mcp/server.py:36-36 (registration)The @mcp.tool() decorator registers the get_aggregate_data function as an MCP tool on the FastMCP server instance.@mcp.tool()