adjust-reporting
Generate mobile analytics reports by specifying date ranges, metrics, dimensions, and filters. Use this tool to query performance data, group insights, and customize report formats with Adjust MCP server integration.
Instructions
Adjust reporting
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ad_spend_mode | No | Determines the ad spend source applied in calculations | |
| attribution_source | No | Whether in-app activity is assigned to install source or divided | dynamic |
| attribution_type | No | Type of engagement the attribution awards | click |
| cohort_maturity | No | Display values for immature or only mature cohorts | |
| currency | No | Currency used for conversion of money related metrics | USD |
| date | No | Date for the report in YYYY-MM-DD format | 2025-08-15 |
| date_period | No | Date period (e.g., this_month, yesterday, 2023-01-01:2023-01-31, -10d:-3d) | |
| dimensions | No | Comma-separated values to group by (e.g., day,country,network). Options include: hour, day, week, month, year, quarter, os_name, device_type, app, app_token, store_id, store_type, currency, currency_code, network, campaign, campaign_network, campaign_id_network, adgroup, adgroup_network, adgroup_id_network, creative, country, country_code, region, partner_name, partner_id, channel, platform | |
| format_dates | No | If false, date dimensions are returned in ISO format | |
| metrics | No | Comma-separated list of metrics to include | installs,sessions,revenue |
| reattributed | No | Filter for reattributed users | all |
| sort | No | Comma-separated list of metrics/dimensions to sort by (use - for descending) | |
| utc_offset | No | Timezone used in the report (e.g., +01:00) |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"ad_spend_mode": {
"description": "Determines the ad spend source applied in calculations",
"enum": [
"adjust",
"network",
"mixed"
],
"type": "string"
},
"attribution_source": {
"default": "dynamic",
"description": "Whether in-app activity is assigned to install source or divided",
"enum": [
"first",
"dynamic"
],
"type": "string"
},
"attribution_type": {
"default": "click",
"description": "Type of engagement the attribution awards",
"enum": [
"click",
"impression",
"all"
],
"type": "string"
},
"cohort_maturity": {
"description": "Display values for immature or only mature cohorts",
"enum": [
"immature",
"mature"
],
"type": "string"
},
"currency": {
"default": "USD",
"description": "Currency used for conversion of money related metrics",
"type": "string"
},
"date": {
"default": "2025-08-15",
"description": "Date for the report in YYYY-MM-DD format",
"type": "string"
},
"date_period": {
"description": "Date period (e.g., this_month, yesterday, 2023-01-01:2023-01-31, -10d:-3d)",
"type": "string"
},
"dimensions": {
"description": "Comma-separated values to group by (e.g., day,country,network). Options include: hour, day, week, month, year, quarter, os_name, device_type, app, app_token, store_id, store_type, currency, currency_code, network, campaign, campaign_network, campaign_id_network, adgroup, adgroup_network, adgroup_id_network, creative, country, country_code, region, partner_name, partner_id, channel, platform",
"type": "string"
},
"format_dates": {
"description": "If false, date dimensions are returned in ISO format",
"type": "boolean"
},
"metrics": {
"default": "installs,sessions,revenue",
"description": "Comma-separated list of metrics to include",
"type": "string"
},
"reattributed": {
"default": "all",
"description": "Filter for reattributed users",
"enum": [
"all",
"false",
"true"
],
"type": "string"
},
"sort": {
"description": "Comma-separated list of metrics/dimensions to sort by (use - for descending)",
"type": "string"
},
"utc_offset": {
"description": "Timezone used in the report (e.g., +01:00)",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/mcp-adjust.ts:58-149 (handler)The main execution logic for the 'adjust-reporting' tool. Processes input parameters, fetches report data from Adjust API using the client, handles empty responses and errors with detailed messages based on HTTP status, analyzes the data using analyzeReportData helper, and returns markdown-formatted content with JSON data.}, async (params, extra) => { try { // Convert all params to a query parameters object const queryParams: Record<string, any> = {}; // Add all non-undefined parameters to the query Object.entries(params).forEach(([key, value]) => { if (value !== undefined) { queryParams[key] = value; } }); // Fetch data from Adjust using our API module const reportData = await client.fetchReports(params.date, queryParams); // Handle empty response if (!reportData || Object.keys(reportData).length === 0) { return { isError: false, content: [ { type: "text" as const, text: `## Adjust Report for ${params.date}\n\nNo data available for the specified parameters.`, } ], }; } // Simple analysis of the data const analysis = analyzeReportData(reportData); return { isError: false, content: [ { type: "text" as const, text: `## Adjust Report for ${params.date}\n\n${analysis}\n\n\`\`\`json\n${JSON.stringify(reportData, null, 2)}\n\`\`\``, } ], }; } catch (error) { console.error("Error fetching or analyzing Adjust data:", error); // Extract status code and message let statusCode = 500; let errorMessage = "Unknown error"; if (error instanceof Error) { errorMessage = error.message; // Check for Axios error with response if ('response' in error && error.response && typeof error.response === 'object') { const axiosError = error as any; statusCode = axiosError.response.status; // Provide helpful messages based on status code switch (statusCode) { case 400: errorMessage = "Bad request: Your query contains invalid parameters or is malformed."; break; case 401: errorMessage = "Unauthorized: Please check your API credentials."; break; case 403: errorMessage = "Forbidden: You don't have permission to access this data."; break; case 429: errorMessage = "Too many requests: You've exceeded the rate limit (max 50 simultaneous requests)."; break; case 503: errorMessage = "Service unavailable: The Adjust API is currently unavailable."; break; case 504: errorMessage = "Gateway timeout: The query took too long to process."; break; default: errorMessage = axiosError.response.data?.message || errorMessage; } } } return { isError: true, content: [ { type: "text" as const, text: `## Error Fetching Adjust Data\n\n**Status Code**: ${statusCode}\n\n**Error**: ${errorMessage}\n\nPlease check your parameters and try again.`, }, ], }; } });
- src/mcp-adjust.ts:26-57 (schema)Zod-based input schema defining parameters for the 'adjust-reporting' tool, including date, metrics, dimensions, and various report configuration options with descriptions, defaults, and enums.date: z.string() .describe("Date for the report in YYYY-MM-DD format") .default(new Date().toISOString().split('T')[0]), metrics: z.string() .describe("Comma-separated list of metrics to include") .default("installs,sessions,revenue"), dimensions: z.string().optional() .describe("Comma-separated values to group by (e.g., day,country,network). Options include: hour, day, week, month, year, quarter, os_name, device_type, app, app_token, store_id, store_type, currency, currency_code, network, campaign, campaign_network, campaign_id_network, adgroup, adgroup_network, adgroup_id_network, creative, country, country_code, region, partner_name, partner_id, channel, platform"), format_dates: z.boolean().optional() .describe("If false, date dimensions are returned in ISO format"), date_period: z.string().optional() .describe("Date period (e.g., this_month, yesterday, 2023-01-01:2023-01-31, -10d:-3d)"), cohort_maturity: z.enum(["immature", "mature"]).optional() .describe("Display values for immature or only mature cohorts"), utc_offset: z.string().optional() .describe("Timezone used in the report (e.g., +01:00)"), attribution_type: z.enum(["click", "impression", "all"]).optional() .default("click") .describe("Type of engagement the attribution awards"), attribution_source: z.enum(["first", "dynamic"]).optional() .default("dynamic") .describe("Whether in-app activity is assigned to install source or divided"), reattributed: z.enum(["all", "false", "true"]).optional() .default("all") .describe("Filter for reattributed users"), ad_spend_mode: z.enum(["adjust", "network", "mixed"]).optional() .describe("Determines the ad spend source applied in calculations"), sort: z.string().optional() .describe("Comma-separated list of metrics/dimensions to sort by (use - for descending)"), currency: z.string().optional() .default("USD") .describe("Currency used for conversion of money related metrics"),
- src/mcp-adjust.ts:25-25 (registration)Registration of the 'adjust-reporting' tool on the MCP server with name, description, input schema, and handler function.server.tool("adjust-reporting", "Adjust reporting", {
- src/mcp-adjust.ts:272-329 (helper)Helper function called by the handler to generate a human-readable markdown analysis from the raw report data, including summaries, breakdowns by dimensions, and warnings.function analyzeReportData(data: any) { let analysis = ""; if (!data || !data.rows || data.rows.length === 0) { return "No data available for analysis."; } // Add totals summary if (data.totals) { analysis += "## Summary\n"; Object.entries(data.totals).forEach(([metric, value]) => { analysis += `**Total ${metric}**: ${value}\n`; }); analysis += "\n"; } // Add row analysis analysis += "## Breakdown\n"; // Get all metrics (non-dimension fields) from the first row const firstRow = data.rows[0]; const metrics = Object.keys(firstRow).filter(key => !['attr_dependency', 'app', 'partner_name', 'campaign', 'campaign_id_network', 'campaign_network', 'adgroup', 'creative', 'country', 'os_name', 'day', 'week', 'month', 'year'].includes(key) ); // Analyze each row data.rows.forEach((row: any, index: number) => { // Create a title for this row based on available dimensions let rowTitle = ""; if (row.campaign) rowTitle += `Campaign: ${row.campaign} `; if (row.partner_name) rowTitle += `(${row.partner_name}) `; if (row.app) rowTitle += `- App: ${row.app} `; if (row.country) rowTitle += `- Country: ${row.country} `; if (row.os_name) rowTitle += `- OS: ${row.os_name} `; analysis += `### ${rowTitle || `Row ${index + 1}`}\n`; // Add metrics for this row metrics.forEach(metric => { if (row[metric] !== undefined) { analysis += `**${metric}**: ${row[metric]}\n`; } }); analysis += "\n"; }); // Add warnings if any if (data.warnings && data.warnings.length > 0) { analysis += "## Warnings\n"; data.warnings.forEach((warning: string) => { analysis += `- ${warning}\n`; }); } return analysis; }
- src/adjust/client.ts:21-43 (helper)The AdjustApiClient.fetchReports method invoked by the tool handler to query the Adjust API reports endpoint with constructed parameters and return the raw data.async fetchReports(date: string, params: Record<string, any> = {}) { try { // Build query parameters const queryParams: Record<string, any> = { ...params }; // If date_period is not provided, use the date parameter if (!queryParams.date_period) { queryParams.date_period = date; } // Make the request to the reports-service endpoint const response = await this.axiosInstance.get('/reports-service/report', { params: queryParams }); return response.data; } catch (error) { console.error("Adjust API Error:", error); throw error; } }