Skip to main content
Glama
metehan777

AlsoAsked MCP Server

by metehan777

search_single_term

Find People Also Ask questions for a single search term to support SEO research and content optimization.

Instructions

Search for PAA questions for a single term (convenience method)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
termYesSingle search term
languageNoLanguage codeen
regionNoRegion codeus
latitudeNoLatitude for geographic targeting
longitudeNoLongitude for geographic targeting
depthNoDepth of question hierarchy

Implementation Reference

  • Handler for 'search_single_term' tool: validates arguments using validateSingleTermArgs, wraps the single term into a terms array, and delegates execution to the shared handleSearch method.
    case 'search_single_term':
      const singleTermArgs = this.validateSingleTermArgs(args);
      const { term, ...otherArgs } = singleTermArgs;
      return await this.handleSearch({ terms: [term], ...otherArgs });
  • Input schema definition for the 'search_single_term' tool, specifying parameters like term (required), language, region, geo coordinates, and depth.
    inputSchema: {
      type: 'object',
      properties: {
        term: {
          type: 'string',
          description: 'Single search term',
        },
        language: {
          type: 'string',
          description: 'Language code',
          default: 'en',
        },
        region: {
          type: 'string',
          description: 'Region code', 
          default: 'us',
        },
        latitude: {
          type: 'number',
          description: 'Latitude for geographic targeting',
        },
        longitude: {
          type: 'number',
          description: 'Longitude for geographic targeting',
        },
        depth: {
          type: 'integer',
          description: 'Depth of question hierarchy',
          default: 2,
          minimum: 1,
          maximum: 3,
        },
      },
      required: ['term'],
    },
  • src/index.ts:173-211 (registration)
    Registration of the 'search_single_term' tool in the ListTools response array, including name, description, and input schema.
    {
      name: 'search_single_term',
      description: 'Search for PAA questions for a single term (convenience method)',
      inputSchema: {
        type: 'object',
        properties: {
          term: {
            type: 'string',
            description: 'Single search term',
          },
          language: {
            type: 'string',
            description: 'Language code',
            default: 'en',
          },
          region: {
            type: 'string',
            description: 'Region code', 
            default: 'us',
          },
          latitude: {
            type: 'number',
            description: 'Latitude for geographic targeting',
          },
          longitude: {
            type: 'number',
            description: 'Longitude for geographic targeting',
          },
          depth: {
            type: 'integer',
            description: 'Depth of question hierarchy',
            default: 2,
            minimum: 1,
            maximum: 3,
          },
        },
        required: ['term'],
      },
    },
  • validateSingleTermArgs helper function: input validation and normalization specific to search_single_term tool arguments.
    private validateSingleTermArgs(args: Record<string, unknown> | undefined): { term: string } & Partial<SearchRequestOptions> {
      if (!args || typeof args !== 'object') {
        throw new Error('Invalid arguments provided');
      }
    
      if (!args.term || typeof args.term !== 'string') {
        throw new Error('term parameter is required and must be a string');
      }
    
      return {
        term: args.term,
        language: typeof args.language === 'string' ? args.language : undefined,
        region: typeof args.region === 'string' ? args.region : undefined,
        latitude: typeof args.latitude === 'number' ? args.latitude : undefined,
        longitude: typeof args.longitude === 'number' ? args.longitude : undefined,
        depth: typeof args.depth === 'number' ? args.depth : undefined,
        fresh: typeof args.fresh === 'boolean' ? args.fresh : undefined,
        async: typeof args.async === 'boolean' ? args.async : undefined,
        notifyWebhooks: typeof args.notifyWebhooks === 'boolean' ? args.notifyWebhooks : undefined,
      };
    }
  • handleSearch core helper: executes the API request to AlsoAsked /search endpoint, processes and formats the response into structured JSON output. Shared with search_people_also_ask tool.
    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),
          },
        ],
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions it's a 'convenience method' which suggests simplicity, but doesn't disclose rate limits, authentication needs, error conditions, or what the search returns (format, pagination, etc.). For a search tool with 6 parameters, this is inadequate.

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 extremely concise - a single sentence that efficiently conveys the core purpose and key constraint (single term). Every word earns its place, and it's front-loaded with the main action.

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?

For a search tool with 6 parameters and no annotations or output schema, the description is insufficient. It doesn't explain what PAA questions are, what format results return, how geographic targeting works with region/language parameters, or the implications of the depth parameter. The 'convenience method' hint is helpful but doesn't compensate for missing context.

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 all parameters are documented in the schema. The description adds no specific parameter semantics beyond implying 'single term' focuses on the 'term' parameter. This meets the baseline when schema coverage is high, but doesn't provide additional value like explaining parameter interactions or constraints.

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 verb ('Search for') and resource ('PAA questions'), specifying it's for a single term. However, it doesn't explicitly differentiate from the sibling tool 'search_people_also_ask' - both appear to search PAA questions, though this one is described as a 'convenience method' which hints at a simpler alternative.

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 context by calling it a 'convenience method' for single-term searches, suggesting it's simpler than alternatives. However, it doesn't explicitly state when to use this versus 'search_people_also_ask' or provide clear exclusions or prerequisites for usage.

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