Skip to main content
Glama

list_business_users

Retrieve a list of users associated with your Meta Business account. Control output with fields, limit, and pagination.

Instructions

List users of the configured business. Requires META_BUSINESS_ID env var.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsNoComma-separated fields to return
limitNoNumber of results (default 25)
afterNoPagination cursor for next page

Implementation Reference

  • The handler function for the 'list_business_users' tool. It retrieves the business ID from the client config, makes a GET request to /{businessId}/business_users with optional pagination parameters (fields, limit, after), and returns the JSON result with rate limit info. Requires META_BUSINESS_ID env var.
    // ─── list_business_users ──────────────────────────────────────
    server.tool(
      "list_business_users",
      "List users of the configured business. Requires META_BUSINESS_ID env var.",
      {
        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 {
          let businessId: string;
          try {
            businessId = client.businessId;
          } catch {
            return { content: [{ type: "text" as const, text: "META_BUSINESS_ID environment variable is required for this operation. Please set it and restart the server." }], isError: true };
          }
          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(`/${businessId}/business_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 };
        }
      }
    );
  • Input schema for 'list_business_users' - defines optional fields (string), limit (number, default 25), and after (string for pagination cursor) using Zod validation.
    {
      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"),
    },
  • The tool is registered via server.tool('list_business_users', ...) inside the registerBusinessTools function in src/tools/business.ts.
    server.tool(
      "list_business_users",
      "List users of the configured business. Requires META_BUSINESS_ID env var.",
      {
        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 {
          let businessId: string;
          try {
            businessId = client.businessId;
          } catch {
            return { content: [{ type: "text" as const, text: "META_BUSINESS_ID environment variable is required for this operation. Please set it and restart the server." }], isError: true };
          }
          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(`/${businessId}/business_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 };
        }
      }
    );
  • The businessId getter on AdsClient that throws if META_BUSINESS_ID env var is not set. Used by the handler to obtain the business ID.
    get businessId(): string {
      if (!this.config.businessId) {
        throw new Error(
          "META_BUSINESS_ID is not configured. Set it as an environment variable."
        );
      }
      return this.config.businessId;
    }
  • The AdsClient.get() method that performs the actual HTTP GET request to the Meta Graph API, used by the handler.
    async get(
      path: string,
      params?: Record<string, unknown>
    ): Promise<ClientResponse> {
      return this.request("GET", path, params);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description carries the full burden. It only states the operation is a list and requires an env var. It does not disclose side effects, auth details beyond the env var, rate limits, or error behavior, which is insufficient for a tool with no annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is one sentence with the main action and a prerequisite, front-loaded and efficient. However, it is somewhat under-specified for completeness, which slightly reduces the score.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the 3 optional parameters and no output schema, the description provides the essential purpose and a critical requirement, but lacks context on pagination, return format, and limitations. The schema covers parameters, so overall it is minimally adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 100% description coverage, so baseline is 3. The description adds no additional meaning beyond the schema; it does not mention the parameters or their usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action 'List users' and the resource 'of the configured business', which is specific and distinguishes it from sibling tools that list other entities like ad accounts or pages.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions a prerequisite (META_BUSINESS_ID env var) but does not provide explicit guidance on when to use this tool versus alternatives or when not to use it. Usage is implied by the tool name and the brief description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mikusnuz/meta-ads-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server