Skip to main content
Glama
johnoconnor0

Google Ads MCP Server

by johnoconnor0

google_ads_get_campaign_details

Retrieve detailed information about a Google Ads campaign using customer ID and campaign ID.

Instructions

Get detailed information about a campaign.

Args: customer_id: Customer ID (without hyphens) campaign_id: Campaign ID

Returns: Detailed campaign information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customer_idYes
campaign_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler that fetches campaign details and formats output. Calls CampaignManager.get_campaign_details() and formats the result into a Markdown string with campaign name, ID, type, status, bidding strategy, dates, network settings, and performance metrics.
    @mcp.tool()
    def google_ads_get_campaign_details(
        customer_id: str,
        campaign_id: str
    ) -> str:
        """
        Get detailed information about a campaign.
    
        Args:
            customer_id: Customer ID (without hyphens)
            campaign_id: Campaign ID
    
        Returns:
            Detailed campaign information
        """
        with performance_logger.track_operation('get_campaign_details', customer_id=customer_id):
            try:
                client = get_auth_manager().get_client()
                campaign_manager = CampaignManager(client)
    
                details = campaign_manager.get_campaign_details(customer_id, campaign_id)
    
                if not details:
                    return f"❌ Campaign {campaign_id} not found"
    
                output = f"# Campaign Details: {details['name']}\n\n"
                output += f"**ID**: {details['id']}\n"
                output += f"**Type**: {details['type']}\n"
                output += f"**Status**: {details['status']}\n"
                output += f"**Bidding Strategy**: {details['bidding_strategy']}\n\n"
    
                output += "## Dates\n"
                output += f"- **Start Date**: {details['start_date'] or 'Not set'}\n"
                output += f"- **End Date**: {details['end_date'] or 'No end date'}\n\n"
    
                output += "## Network Settings\n"
                output += f"- **Google Search**: {details['network_settings']['google_search']}\n"
                output += f"- **Search Network**: {details['network_settings']['search_network']}\n"
                output += f"- **Display Network**: {details['network_settings']['content_network']}\n\n"
    
                if details['metrics']:
                    output += "## Performance Metrics\n"
                    output += f"- **Cost**: ${details['metrics']['cost']:,.2f}\n"
                    output += f"- **Clicks**: {details['metrics']['clicks']:,}\n"
                    output += f"- **Impressions**: {details['metrics']['impressions']:,}\n"
                    output += f"- **Conversions**: {details['metrics']['conversions']}\n"
    
                return output
    
            except Exception as e:
                error_msg = ErrorHandler.handle_error(e, context="get_campaign_details")
                return f"❌ Failed to get campaign details: {error_msg}"
  • Helper/manager method that executes the GAQL query to fetch campaign details from Google Ads API. Queries campaign fields (id, name, status, type, budget, dates, bidding strategy, network settings) and metrics (cost, clicks, impressions, conversions), then maps the response row to a dictionary.
    def get_campaign_details(
        self,
        customer_id: str,
        campaign_id: str
    ) -> Dict[str, Any]:
        """
        Get detailed campaign information.
    
        Args:
            customer_id: Customer ID
            campaign_id: Campaign ID
    
        Returns:
            Campaign details
        """
        query = f"""
            SELECT
                campaign.id,
                campaign.name,
                campaign.status,
                campaign.advertising_channel_type,
                campaign.campaign_budget,
                campaign.start_date,
                campaign.end_date,
                campaign.bidding_strategy_type,
                campaign.network_settings.target_google_search,
                campaign.network_settings.target_search_network,
                campaign.network_settings.target_content_network,
                campaign.target_cpa.target_cpa_micros,
                campaign.target_roas.target_roas,
                metrics.cost_micros,
                metrics.clicks,
                metrics.impressions,
                metrics.conversions
            FROM campaign
            WHERE campaign.id = {campaign_id}
        """
    
        ga_service = self.client.get_service("GoogleAdsService")
        response = ga_service.search(customer_id=customer_id, query=query)
    
        for row in response:
            return {
                "id": str(row.campaign.id),
                "name": row.campaign.name,
                "status": row.campaign.status.name,
                "type": row.campaign.advertising_channel_type.name,
                "budget": row.campaign.campaign_budget,
                "start_date": row.campaign.start_date,
                "end_date": row.campaign.end_date,
                "bidding_strategy": row.campaign.bidding_strategy_type.name,
                "network_settings": {
                    "google_search": row.campaign.network_settings.target_google_search,
                    "search_network": row.campaign.network_settings.target_search_network,
                    "content_network": row.campaign.network_settings.target_content_network
                },
                "metrics": {
                    "cost": row.metrics.cost_micros / 1_000_000,
                    "clicks": row.metrics.clicks,
                    "impressions": row.metrics.impressions,
                    "conversions": row.metrics.conversions
                }
            }
    
        return None
  • Registration function that registers all campaign MCP tools including google_ads_get_campaign_details via @mcp.tool() decorator.
    def register_campaign_tools(mcp: FastMCP):
        """Register campaign management tools with MCP server."""
Behavior2/5

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

No annotations are provided, so the description must disclose behavior. It only says 'Get detailed information', which is vague. It doesn't mention that the operation is read-only, any authentication requirements, rate limits, or size of returned data. This fails to inform the agent of important behavioral traits.

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

Conciseness3/5

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

The description is short and structured with Args/Returns sections, but it is slightly too sparse. It could include more detail without being verbose. The returns section is a single line that adds little. Every sentence earns its place, but the Returns part is weak.

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

Completeness2/5

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

Given the existence of an output schema, the returns description can be brief, but the description lacks broader context. It does not explain what 'detailed information' entails or relate to the large set of sibling tools. The agent may not know how this tool fits into a workflow.

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 no descriptions (0% coverage). The description adds 'without hyphens' for customer_id and implies both are required. This adds meaningful constraint beyond schema structure. However, it does not specify format for campaign_id or other semantic details, leaving some gap.

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 gets detailed campaign information, identifying the resource (campaign) and action (get details). It specifies required parameters (customer_id, campaign_id). However, it does not differentiate from many similar get_* sibling tools like google_ads_get_ad_group_details, so clarity is slightly reduced.

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 usage guidance is provided. The description does not indicate when to use this tool versus alternatives, nor does it mention prerequisites or exclusions. Given numerous sibling get_* tools, agents would benefit from explicit context, which is absent.

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/johnoconnor0/google-ads-mcp'

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