Skip to main content
Glama
martechery

Google Ads MCP Server

by martechery

gaql_help

Access documentation and official Google Ads API resources for GAQL queries. Use topic selection or keyword search to understand query structure, syntax, and best practices.

Instructions

Get GAQL help with local documentation and official Google Ads API links. Use topic for specific areas or search for keywords.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicNospecific GAQL topic to retrieve
searchNosearch term for help content

Implementation Reference

  • The primary handler function for the gaql_help tool. It provides GAQL documentation either for a specific topic from local markdown files or a default overview including quick tips, API version info, and links to official docs.
    export async function gaqlHelp(input: GaqlHelpInput = {}): Promise<string> {
      const sections: string[] = [];
      const version = getApiVersion();
      
      // If specific topic requested, return just that topic
      if (input.topic) {
        const topicContent = await readSpecificTopic(input.topic);
        if (topicContent) {
          sections.push(`# GAQL Help: ${input.topic.replace('-', ' ').toUpperCase()}`);
          sections.push(`**API Version**: ${version}\n`);
          sections.push(topicContent);
          
          // Add relevant official documentation link
          const officialUrl = OFFICIAL_URLS[input.topic.replace('-', '_') as keyof typeof OFFICIAL_URLS];
          if (officialUrl) {
            sections.push(`\n**Official Documentation**: ${officialUrl}`);
          }
          sections.push(`\n**Field References**: ${getFieldReferenceUrls().join(', ')}`);
          
          return sections.join('\n');
        } else {
          return `Topic "${input.topic}" not found. Available topics: ${AVAILABLE_TOPICS.join(', ')}`;
        }
      }
      
      // Default: Show overview with available topics
      sections.push('# Google Ads Query Language (GAQL) Help');
      
      // Show available topics
      sections.push(`
    ## Available Topics
    Use the topic parameter to get specific documentation:
    ${AVAILABLE_TOPICS.map(topic => `- **${topic}**: ${topic.replace('-', ' ')} documentation`).join('\n')}
    
    Example: Use topic="overview" for basic GAQL concepts`);
    
      // Quick Tips
      sections.push(`
    ## Quick Tips
    - FROM uses a RESOURCE (use list_resources tool to discover available resources)
    - SELECT fields must be selectable for the chosen FROM resource  
    - WHERE supports =, !=, <, >, >=, <=, LIKE, IN, DURING (for date ranges)
    - Date ranges: DURING LAST_7_DAYS, LAST_30_DAYS, THIS_MONTH, etc.
    - ORDER BY field [ASC|DESC], LIMIT n for sorting and limiting results
    - Case sensitivity: field names are case-insensitive; string values are case-sensitive
    - Cost fields are in micros - divide by 1,000,000 for actual currency amounts
    - Use customer.currency_code to interpret cost_micros correctly`);
    
      // API Version Info
      sections.push(`
    ## Current API Version: ${version}
    The MCP server is configured to use API version ${version}.
    Set GOOGLE_ADS_API_VERSION environment variable to use a different version.`);
    
      // Official Documentation Links
      sections.push(`
    ## Official Documentation
    ${Object.entries(OFFICIAL_URLS).map(([topic, url]) => `- ${topic.replace('_', ' ')}: ${url}`).join('\n')}
    
    ## Field References  
    ${getFieldReferenceUrls().join('\n')}`);
    
      // Footer
      sections.push(`
    ## Need More Help?
    - Use topic parameter to get detailed documentation on specific areas
    - Use the "list_resources" tool to discover available resources and their fields
    - Use the "execute_gaql_query" tool to test your queries
    - Check field compatibility in the official API reference above`);
    
      return sections.join('\n');
    }
  • The registration of the 'gaql_help' tool using addTool(server, name, description, schema, handler), where the handler wraps and calls the gaqlHelp function with logging.
      server,
      "gaql_help",
      "Get GAQL help with local documentation and official Google Ads API links. Use topic for specific areas or search for keywords.",
      GaqlHelpZ,
      async (input: any) => {
        const startTs = Date.now();
        try {
          const text = await gaqlHelp({
            topic: input?.topic,
            search: input?.search,
          });
          const out = { content: [{ type: 'text', text }] };
          logEvent('gaql_help', startTs, { requestId: input?.request_id });
          return out;
        } catch (e: any) {
          const lines = [
            `Error fetching GAQL help: ${e?.message || String(e)}`,
            'Hint: set quick_tips=true to avoid network usage.',
          ];
          const out = { content: [{ type: 'text', text: lines.join('\n') }] };
          logEvent('gaql_help', startTs, { requestId: input?.request_id, error: { code: 'ERR_HELP', message: String(e?.message || e) } });
          return out;
        }
      }
    );
  • Zod schema (GaqlHelpZ) defining the input parameters for the gaql_help tool: optional topic (enum of GAQL topics) and search string.
    export const GaqlHelpZ = z.object({
      topic: z.enum(['overview', 'grammar', 'structure', 'date-ranges', 'case-sensitivity', 'ordering-limiting', 'cookbook', 'field-reference']).optional().describe('specific GAQL topic to retrieve'),
      search: z.string().optional().describe('search term for help content'),
    });
    export const GaqlHelpSchema: JsonSchema = zodToJsonSchema(GaqlHelpZ, 'GaqlHelp') as unknown as JsonSchema;
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. It mentions 'local documentation and official Google Ads API links,' which hints at the tool's behavior (returning help content), but it doesn't disclose key traits like whether it's read-only, what format the output is in, rate limits, or authentication needs. For a tool with no annotations, this is a significant gap, warranting a 2.

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 front-loaded and concise: two sentences with zero waste. The first sentence states the purpose, and the second provides usage hints. Every sentence earns its place, making it efficient and well-structured.

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 has 2 parameters with full schema coverage and no output schema, the description is moderately complete. It covers the basic purpose and parameter usage but lacks details on behavioral traits (e.g., output format, error handling) and doesn't fully leverage the context of sibling tools. For a help tool with no annotations, it should do more to be fully helpful, so it's a 3.

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 both parameters (topic with enum values and search). The description adds minimal value beyond the schema by suggesting how to use them ('Use topic for specific areas or search for keywords'), but it doesn't provide additional semantics like examples or deeper context. Baseline is 3 when schema coverage is high.

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's purpose: 'Get GAQL help with local documentation and official Google Ads API links.' It specifies the verb ('Get') and resource ('GAQL help'), and distinguishes it from siblings like execute_gaql_query (which runs queries) and list_resources (which lists data). However, it doesn't explicitly differentiate from all siblings, such as get_performance or manage_auth, which is why it's a 4 rather than a 5.

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 provides implied usage guidance: 'Use topic for specific areas or search for keywords.' This suggests when to use each parameter, but it doesn't explicitly state when to choose this tool over alternatives (e.g., vs. general documentation or other help tools) or any prerequisites. Given the sibling tools include execute_gaql_query, more explicit differentiation would be helpful, so it's a 3.

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

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