Skip to main content
Glama
metehan777

AlsoAsked MCP Server

by metehan777

search_people_also_ask

Discover related questions from Google's People Also Ask feature to enhance SEO research and content planning by analyzing search term hierarchies.

Instructions

Search for "People Also Ask" questions related to search terms. Returns hierarchical question data from Google PAA.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
termsYesArray of search terms to query
languageNoLanguage code (e.g., "en", "es", "fr")en
regionNoRegion code (e.g., "us", "uk", "ca")us
latitudeNoLatitude for geographic targeting (e.g., 40.7128 for NYC, 31.9686 for Texas)
longitudeNoLongitude for geographic targeting (e.g., -74.0060 for NYC, -99.9018 for Texas)
depthNoDepth of question hierarchy (1-3)
freshNoWhether to fetch fresh results or use cached data
asyncNoWhether to process request asynchronously

Implementation Reference

  • The main handler function that validates input, makes the API request to AlsoAsked /search endpoint, processes the hierarchical PAA results, formats them, and returns structured JSON content via MCP tool response.
    private async handleSearch(options: SearchRequestOptions) {
      const searchData: SearchRequestOptions = {
        terms: options.terms,
        language: options.language || 'en',
        region: options.region || 'us', 
        latitude: options.latitude,
        longitude: options.longitude,
        depth: options.depth || 2,
        fresh: options.fresh || false,
        async: options.async || false,
        notifyWebhooks: options.notifyWebhooks || false,
      };
    
      // Remove undefined values to avoid sending them to the API
      Object.keys(searchData).forEach(key => {
        if (searchData[key as keyof SearchRequestOptions] === undefined) {
          delete searchData[key as keyof SearchRequestOptions];
        }
      });
    
      const response: SearchResponse = await this.makeApiRequest('/search', {
        method: 'POST',
        body: JSON.stringify(searchData),
      });
    
      if (response.status !== 'success') {
        throw new Error(`Search failed: ${response.message || 'Unknown error'}`);
      }
    
      // Format results for better readability
      const formattedResults = response.queries.map(query => ({
        searchTerm: query.term,
        totalQuestions: this.countTotalQuestions(query.results),
        questions: this.formatQuestionHierarchy(query.results),
      }));
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              status: response.status,
              searchId: response.id,
              results: formattedResults,
              summary: {
                totalSearchTerms: response.queries.length,
                totalQuestions: formattedResults.reduce((sum, result) => sum + result.totalQuestions, 0),
              }
            }, null, 2),
          },
        ],
      };
    }
  • src/index.ts:115-164 (registration)
    MCP tool registration in the ListTools handler, defining the tool name, description, and detailed input schema with properties, defaults, and requirements.
    {
      name: 'search_people_also_ask',
      description: 'Search for "People Also Ask" questions related to search terms. Returns hierarchical question data from Google PAA.',
      inputSchema: {
        type: 'object',
        properties: {
          terms: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of search terms to query',
          },
          language: {
            type: 'string',
            description: 'Language code (e.g., "en", "es", "fr")',
            default: 'en',
          },
          region: {
            type: 'string', 
            description: 'Region code (e.g., "us", "uk", "ca")',
            default: 'us',
          },
          latitude: {
            type: 'number',
            description: 'Latitude for geographic targeting (e.g., 40.7128 for NYC, 31.9686 for Texas)',
          },
          longitude: {
            type: 'number',
            description: 'Longitude for geographic targeting (e.g., -74.0060 for NYC, -99.9018 for Texas)',
          },
          depth: {
            type: 'integer',
            description: 'Depth of question hierarchy (1-3)',
            default: 2,
            minimum: 1,
            maximum: 3,
          },
          fresh: {
            type: 'boolean',
            description: 'Whether to fetch fresh results or use cached data',
            default: false,
          },
          async: {
            type: 'boolean',
            description: 'Whether to process request asynchronously',
            default: false,
          },
        },
        required: ['terms'],
      },
    },
  • TypeScript interfaces defining the structure for search requests, results, queries, and responses used by the search_people_also_ask tool.
    interface SearchRequestOptions {
      terms: string[];
      language?: string;
      region?: string;
      latitude?: number;
      longitude?: number;
      depth?: number;
      fresh?: boolean;
      async?: boolean;
      notifyWebhooks?: boolean;
    }
    
    interface SearchResult {
      question: string;
      results?: SearchResult[];
    }
    
    interface SearchQuery {
      term: string;
      results: SearchResult[];
    }
    
    interface SearchResponse {
      status: string;
      queries: SearchQuery[];
      id?: string;
      message?: string;
    }
  • Dispatch case in the CallToolRequestSchema handler that routes calls to search_people_also_ask to the handleSearch method after validation.
    case 'search_people_also_ask':
      return await this.handleSearch(this.validateSearchArgs(args));
  • Helper function to validate and normalize input arguments against the tool schema, providing defaults and type checks.
    private validateSearchArgs(args: Record<string, unknown> | undefined): SearchRequestOptions {
      if (!args || typeof args !== 'object') {
        throw new Error('Invalid arguments provided');
      }
    
      if (!args.terms || !Array.isArray(args.terms)) {
        throw new Error('terms parameter is required and must be an array');
      }
    
      return {
        terms: args.terms as string[],
        language: typeof args.language === 'string' ? args.language : 'en',
        region: typeof args.region === 'string' ? args.region : 'us',
        latitude: typeof args.latitude === 'number' ? args.latitude : undefined,
        longitude: typeof args.longitude === 'number' ? args.longitude : undefined,
        depth: typeof args.depth === 'number' ? args.depth : 2,
        fresh: typeof args.fresh === 'boolean' ? args.fresh : false,
        async: typeof args.async === 'boolean' ? args.async : false,
        notifyWebhooks: typeof args.notifyWebhooks === 'boolean' ? args.notifyWebhooks : false,
      };
    }
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 the tool returns hierarchical question data, but lacks details on rate limits, authentication needs, error handling, or whether it's a read-only or mutative operation. For a tool with 8 parameters and no annotation coverage, this is a significant gap in behavioral disclosure.

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, front-loaded with the core purpose and followed by the return type. Every word earns its place, making it highly efficient and easy to parse.

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 complexity (8 parameters, no annotations, no output schema), the description is minimal but covers the basic purpose and return data. However, it lacks details on output format, error conditions, or behavioral traits, leaving gaps for an AI agent to fully understand how to use it correctly.

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 fully documents all 8 parameters. The description adds no additional parameter semantics beyond what's in the schema, such as explaining interactions between parameters or providing examples. 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 ('Search for'), resource ('People Also Ask' questions), and outcome ('Returns hierarchical question data from Google PAA'). It distinguishes from sibling tools like 'get_account_info' and 'search_single_term' by focusing on hierarchical PAA data rather than account info or single-term search.

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 for obtaining hierarchical PAA data related to search terms, but does not explicitly state when to use this tool versus alternatives like 'search_single_term' or provide any exclusions or prerequisites. Usage context is inferred rather than clearly defined.

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/metehan777/alsoasked-mcp'

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