list_google_ads_links
Retrieve linked Google Ads accounts for a Google Analytics property by providing the property ID.
Instructions
Returns a list of links to Google Ads accounts for a property.
Args:
property_id: The Google Analytics property ID. Accepted formats are:
- A number
- A string consisting of 'properties/' followed by a number
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| property_id | Yes |
Implementation Reference
- analytics_mcp/tools/admin/info.py:42-60 (handler)The main handler function for the 'list_google_ads_links' MCP tool. It is decorated with @mcp.tool() for registration and implements the logic to fetch Google Ads links for a specified property using the Google Analytics Admin API v1beta.@mcp.tool(title="List links to Google Ads accounts") async def list_google_ads_links(property_id: int | str) -> List[Dict[str, Any]]: """Returns a list of links to Google Ads accounts for a property. Args: property_id: The Google Analytics property ID. Accepted formats are: - A number - A string consisting of 'properties/' followed by a number """ request = admin_v1beta.ListGoogleAdsLinksRequest( parent=construct_property_rn(property_id) ) # Uses an async list comprehension so the pager returned by # list_google_ads_links retrieves all pages. links_pager = await create_admin_api_client().list_google_ads_links( request=request ) all_pages = [proto_to_dict(link_page) async for link_page in links_pager] return all_pages