Skip to main content
Glama
wonyoungseong

GA4 MCP Server

ga4_google_ads_links

List Google Ads accounts connected to a GA4 property to view data sharing links and manage advertising integrations.

Instructions

Returns a list of links to Google Ads accounts for a GA4 property. Shows which Google Ads accounts are connected to the property for data sharing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
propertyIdYesThe Google Analytics property ID. Accepted formats: '123456789' or 'properties/123456789'

Implementation Reference

  • The main handler function listGoogleAdsLinks that implements the tool logic. It retrieves Google Ads links for a GA4 property by calling the Analytics Admin API, handles pagination, and returns a formatted response with the links array and total count.
    export async function listGoogleAdsLinks(propertyId: string): Promise<ToolResponse> {
      try {
        const client = await getAnalyticsAdminClient();
        const propertyName = constructPropertyResourceName(propertyId);
        const allLinks: unknown[] = [];
        let pageToken: string | undefined | null = undefined;
    
        do {
          const response: { data: GoogleAdsLinksResponse } = await client.properties.googleAdsLinks.list({
            parent: propertyName,
            pageToken: pageToken || undefined,
            pageSize: 200,
          });
    
          const data = response.data;
          if (data.googleAdsLinks) {
            allLinks.push(...data.googleAdsLinks);
          }
          pageToken = data.nextPageToken;
        } while (pageToken);
    
        return createSuccessResponse({
          googleAdsLinks: allLinks,
          totalCount: allLinks.length,
        });
      } catch (error) {
        return createErrorResponse(`Failed to list Google Ads links for ${propertyId}`, error);
      }
    }
  • Tool registration and schema definition for ga4_google_ads_links. Defines the tool name, description, and input schema requiring a propertyId parameter.
    {
      name: "ga4_google_ads_links",
      description: "Returns a list of links to Google Ads accounts for a GA4 property. Shows which Google Ads accounts are connected to the property for data sharing.",
      inputSchema: {
        type: "object" as const,
        properties: {
          propertyId: {
            type: "string",
            description: "The Google Analytics property ID. Accepted formats: '123456789' or 'properties/123456789'",
          },
        },
        required: ["propertyId"],
      },
    },
  • Tool routing that connects the ga4_google_ads_links tool name to its handler function listGoogleAdsLinks, extracting and casting the propertyId argument.
    case "ga4_google_ads_links":
      return await listGoogleAdsLinks(args.propertyId as string);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states this is a read operation ('Returns a list'), but does not mention permissions required, rate limits, pagination, or error handling. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 two sentences with zero waste: the first states the purpose, and the second adds context about data sharing. It is appropriately sized and front-loaded, making it easy to understand quickly without unnecessary details.

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 tool's low complexity (single parameter, no output schema) and lack of annotations, the description is minimally adequate but incomplete. It covers the basic purpose but lacks behavioral details like response format or error cases. For a read-only tool with simple inputs, this is borderline viable but could be more informative.

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?

Schema description coverage is 100%, so the schema already documents the propertyId parameter thoroughly. The description does not add any meaning beyond what the schema provides, such as explaining why this parameter is needed or how it relates to the output. Baseline 3 is appropriate when the schema does the heavy lifting.

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 specific action ('Returns a list of links') and resource ('Google Ads accounts for a GA4 property'), and distinguishes it from siblings by focusing on account connections rather than reports, summaries, or other property details. It explicitly mentions 'data sharing' to clarify the purpose beyond just listing.

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 implies usage when needing to see connected Google Ads accounts for data sharing, but does not explicitly state when to use this tool versus alternatives like ga4_property_details or other siblings. No exclusions or prerequisites are mentioned, leaving the context somewhat open-ended.

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/wonyoungseong/ga4-mcp-server'

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