list_account_users
Retrieve all users with access to a Facebook ad account, including their roles and permissions. Use field selection and pagination to refine results.
Instructions
List users who have access to the ad account with their roles and permissions.
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:94-115 (handler)The handler function for the list_account_users tool. Calls GET `${client.accountPath}/users` with optional fields, limit, and after parameters, and returns the JSON response with rate limit info.
// ─── list_account_users ─────────────────────────────────────── server.tool( "list_account_users", "List users who have access to the ad account with their roles and permissions.", { 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}/users`, 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:94-115 (schema)Input schema validation for list_account_users: fields (optional string), limit (optional number, default 25), after (optional string for pagination). Uses Zod for validation.
// ─── list_account_users ─────────────────────────────────────── server.tool( "list_account_users", "List users who have access to the ad account with their roles and permissions.", { 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}/users`, 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:94-115 (registration)Registration: server.tool('list_account_users', ...) is called inside registerAccountTools which is invoked in src/index.ts (line 89).
// ─── list_account_users ─────────────────────────────────────── server.tool( "list_account_users", "List users who have access to the ad account with their roles and permissions.", { 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}/users`, 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/index.ts:89-89 (registration)Registration invocation: registerAccountTools(server, client) is called, which registers the list_account_users tool on the MCP server.
registerAccountTools(server, client);