list_google_ads_links
Retrieve a list of Google Ads accounts linked to a specific 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
| Name | Required | Description | Default |
|---|---|---|---|
| property_id | Yes |
Input Schema (JSON Schema)
{
"properties": {
"property_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
}
],
"title": "Property Id"
}
},
"required": [
"property_id"
],
"title": "list_google_ads_linksArguments",
"type": "object"
}
Implementation Reference
- analytics_mcp/tools/admin/info.py:42-60 (handler)The handler function for the 'list_google_ads_links' MCP tool. It constructs a request to list Google Ads links for the given property using the Google Analytics Admin API v1beta, paginates through all results asynchronously, converts protobuf responses to dictionaries, and returns the list.@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
- analytics_mcp/tools/admin/info.py:42-42 (registration)Registers the 'list_google_ads_links' tool with MCP using the @mcp.tool decorator, providing a display title.@mcp.tool(title="List links to Google Ads accounts")