get_account_activities
Retrieve activity logs for an ad account to track changes made to campaigns, ad sets, and ads.
Instructions
Get activity log for the ad account. Shows changes made to campaigns, ad sets, ads, etc.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fields | No | Comma-separated fields to return | |
| limit | No | Number of results (default 25) | |
| after | No | Pagination cursor for next page |
Implementation Reference
- src/tools/account.ts:72-92 (handler)The tool registration and handler for 'get_account_activities'. It defines the schema (fields, limit, after), builds query params, and calls client.get to fetch activity log from the ad account.
server.tool( "get_account_activities", "Get activity log for the ad account. Shows changes made to campaigns, ad sets, ads, etc.", { fields: z.string().optional().describe("Comma-separated fields to return"), limit: z.number().optional().default(25).describe("Number of results (default 25)"), after: z.string().optional().describe("Pagination cursor for next page"), }, async ({ fields, limit, after }) => { try { const params: Record<string, unknown> = {}; if (fields) params.fields = fields; if (limit) params.limit = limit; if (after) params.after = after; const { data, rateLimit } = await client.get(`${client.accountPath}/activities`, params); return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } ); - src/tools/account.ts:75-79 (schema)Input schema for the tool: optional 'fields' (string), optional 'limit' (number, default 25), optional 'after' (pagination cursor string).
{ fields: z.string().optional().describe("Comma-separated fields to return"), limit: z.number().optional().default(25).describe("Number of results (default 25)"), after: z.string().optional().describe("Pagination cursor for next page"), }, - src/index.ts:89-90 (registration)Registration call: registerAccountTools(server, client) wires up all account tools including get_account_activities.
registerAccountTools(server, client); registerBusinessTools(server, client); - src/tools/account.ts:5-5 (registration)Export signature of registerAccountTools which registers all account-related tools on the server.
export function registerAccountTools(server: McpServer, client: AdsClient): void {