Skip to main content
Glama

get_ad_account

Retrieve ad account details such as status, balance, currency, timezone, and spend info for the configured account.

Instructions

Get details of the configured ad account including status, balance, currency, timezone, and spend info.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsNoComma-separated fields to returnid,name,account_status,balance,currency,timezone_name,amount_spent,business_name,business_city,business_country_code,owner,min_campaign_group_spend_cap

Implementation Reference

  • Handler function for the 'get_ad_account' tool. Makes a GET request to the Meta Ads API (configured ad account path) with optional fields parameter, and returns the account details along with rate limit info.
    server.tool(
      "get_ad_account",
      "Get details of the configured ad account including status, balance, currency, timezone, and spend info.",
      {
        fields: z.string().optional().default("id,name,account_status,balance,currency,timezone_name,amount_spent,business_name,business_city,business_country_code,owner,min_campaign_group_spend_cap").describe("Comma-separated fields to return"),
      },
      async ({ fields }) => {
        try {
          const params: Record<string, unknown> = {};
          if (fields) params.fields = fields;
          const { data, rateLimit } = await client.get(`${client.accountPath}`, 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 'get_ad_account' tool using Zod. The only parameter is 'fields' (optional string with defaults) describing which comma-separated fields to return.
    {
      fields: z.string().optional().default("id,name,account_status,balance,currency,timezone_name,amount_spent,business_name,business_city,business_country_code,owner,min_campaign_group_spend_cap").describe("Comma-separated fields to return"),
    },
  • Registration via server.tool() inside registerAccountTools(). Called from src/index.ts line 89 with the MCP server and AdsClient instance.
    export function registerAccountTools(server: McpServer, client: AdsClient): void {
      // ─── get_ad_account ───────────────────────────────────────────
      server.tool(
        "get_ad_account",
        "Get details of the configured ad account including status, balance, currency, timezone, and spend info.",
        {
          fields: z.string().optional().default("id,name,account_status,balance,currency,timezone_name,amount_spent,business_name,business_city,business_country_code,owner,min_campaign_group_spend_cap").describe("Comma-separated fields to return"),
        },
        async ({ fields }) => {
          try {
            const params: Record<string, unknown> = {};
            if (fields) params.fields = fields;
            const { data, rateLimit } = await client.get(`${client.accountPath}`, 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 accountPath getter (returns `/act_{accountId}`) used by the handler as the API endpoint path, and accountId getter which reads from config.
    get accountPath(): string {
      return `/act_${this.accountId}`;
    }
    
    get accountId(): string {
      if (!this.config.adAccountId) {
        throw new Error(
          "META_AD_ACCOUNT_ID is not configured. Set it as an environment variable."
        );
      }
      return this.config.adAccountId;
    }
  • The AdsClient.get() method used by the handler to make the GET request to the Meta Ads API.
    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?

The description indicates a read operation ('Get details'), but there are no annotations to confirm read-only behavior. It does not disclose other behavioral traits such as authentication requirements, rate limits, idempotency, or side effects. Without annotations, the description's minimalism leaves gaps.

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

Conciseness5/5

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

The description is a single sentence that is direct and front-loaded. It avoids any filler or redundant information, making it highly concise and easy to parse.

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?

For a simple tool with one optional parameter and no output schema, the description is adequate but not rich. It could mention that it targets the currently configured ad account or list common fields, but the schema compensates. Overall, it meets minimum viability but has room for improvement.

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?

The input schema has one parameter ('fields') with a default and a description. The tool's description does not add any additional meaning beyond what the schema already provides. Since schema coverage is 100%, the baseline is 3, and no extra value is added.

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

Purpose4/5

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

The description clearly states the tool retrieves details of the configured ad account, listing specific fields like status, balance, and currency. It uses a specific verb (Get) and resource (ad account), but does not explicitly differentiate it from sibling tools like 'list_ad_accounts' or 'update_ad_account'. However, the singular nature is implied.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like 'list_ad_accounts' or 'update_ad_account'. The description does not mention prerequisites, exclusions, or contextual hints for selection.

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