Skip to main content
Glama

research_topic

Research topics using Brave Search and Perplexity to gather information, facts, trends, news, and hashtags for social media content creation.

Instructions

Research a topic using Brave Search and Perplexity

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicYesTopic to research
includeHashtagsNoWhether to include relevant hashtags
includeFactsNoWhether to include facts about the topic
includeTrendsNoWhether to include trending information
includeNewsNoWhether to include news articles

Implementation Reference

  • The primary handler function for the 'research_topic' MCP tool. It processes input arguments, calls the research aggregator, formats the response, and handles errors.
    private async handleResearchTopic(args: any) {
      logger.info('Researching topic', { topic: args.topic });
      
      try {
        const topic = args.topic;
        const options = {
          includeHashtags: args.includeHashtags || false,
          includeFacts: args.includeFacts || false,
          includeTrends: args.includeTrends || false,
          includeNews: args.includeNews || false,
        };
        
        const researchData = await researchAggregator.researchTopic(topic, options);
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                topic,
                options,
                researchData,
                status: 'success',
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        logger.error('Error researching topic', { 
          topic: args.topic,
          error: error instanceof Error ? error.message : String(error) 
        });
        
        throw error;
      }
    }
  • Tool definition including name, description, and input schema for 'research_topic' used in tool listing.
    {
      name: 'research_topic',
      description: 'Research a topic using Brave Search and Perplexity',
      inputSchema: {
        type: 'object',
        properties: {
          topic: {
            type: 'string',
            description: 'Topic to research',
          },
          includeHashtags: {
            type: 'boolean',
            description: 'Whether to include relevant hashtags',
          },
          includeFacts: {
            type: 'boolean',
            description: 'Whether to include facts about the topic',
          },
          includeTrends: {
            type: 'boolean',
            description: 'Whether to include trending information',
          },
          includeNews: {
            type: 'boolean',
            description: 'Whether to include news articles',
          },
        },
        required: ['topic'],
      },
    },
  • src/index.ts:181-187 (registration)
    Tool dispatch registration in the CallToolRequestSchema handler, routing 'research_topic' to its handler function.
    switch (request.params.name) {
      case 'create_post':
        return await this.handleCreatePost(request.params.arguments);
      case 'get_trending_topics':
        return await this.handleGetTrendingTopics(request.params.arguments);
      case 'research_topic':
        return await this.handleResearchTopic(request.params.arguments);
  • Core research logic implementing topic research using Brave Search and Perplexity clients, extracting hashtags, facts, news, and trends. Called by the tool handler.
    async researchTopic(
      topic: string,
      options: {
        includeHashtags?: boolean;
        includeFacts?: boolean;
        includeTrends?: boolean;
        includeNews?: boolean;
      } = {}
    ): Promise<ResearchData> {
      logger.info('Researching topic', { topic, options });
    
      const researchData: ResearchData = {
        sources: [],
      };
    
      try {
        // Get search results from Brave Search
        const searchResults = await braveClient.search(topic, 10);
        
        // Add Brave Search as a source
        researchData.sources.push(searchResults.source);
        
        // Extract hashtags if requested
        if (options.includeHashtags) {
          researchData.hashtags = await braveClient.extractHashtags(topic, 5);
        }
        
        // Extract facts if requested
        if (options.includeFacts) {
          try {
            // Get in-depth research from Perplexity
            const perplexityResults = await perplexityClient.research(topic, { depth: 'detailed' });
            
            // Add Perplexity as a source
            researchData.sources.push(perplexityResults.source);
            
            // Use Perplexity facts if available, otherwise extract from search results
            if (perplexityResults.facts && perplexityResults.facts.length > 0) {
              researchData.facts = perplexityResults.facts;
              logger.info('Using Perplexity facts', { count: perplexityResults.facts.length });
            } else {
              researchData.facts = this.extractFacts(searchResults);
              logger.info('Using extracted facts from search results', { count: researchData.facts.length });
            }
          } catch (error) {
            logger.warn('Error getting Perplexity research, falling back to extracted facts', {
              error: error instanceof Error ? error.message : String(error)
            });
            
            // Fall back to extracting facts from search results
            researchData.facts = this.extractFacts(searchResults);
          }
        }
        
        // Extract news if requested
        if (options.includeNews) {
          researchData.news = this.extractNews(searchResults);
        }
        
        // Get trends if requested
        // Note: In a complete implementation, this would use the Twitter and Mastodon clients
        if (options.includeTrends) {
          researchData.trends = this.generatePlaceholderTrends(topic);
        }
        
        logger.info('Research completed successfully', { 
          topic,
          hashtagCount: researchData.hashtags?.length || 0,
          factCount: researchData.facts?.length || 0,
          newsCount: researchData.news?.length || 0,
          trendCount: researchData.trends?.length || 0,
        });
        
        return researchData;
      } catch (error) {
        logger.error('Error researching topic', { 
          topic,
          error: error instanceof Error ? error.message : String(error) 
        });
        
        throw error;
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It mentions the search engines used but doesn't describe rate limits, authentication needs, response format, pagination, or what constitutes 'research' output. For a tool with 5 parameters and no annotations, this is insufficient behavioral context.

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 at just 6 words, with zero wasted language. It's front-loaded with the core action and immediately specifies the search engines used. Every word serves a purpose in this minimal but complete statement of function.

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 research tool with 5 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what the research output looks like, how results are structured, what sources are consulted beyond the named search engines, or limitations of the research process. The agent would have significant gaps in understanding how to effectively use this tool.

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 doesn't add any parameter-specific information beyond what's already in the schema descriptions. This meets the baseline expectation when schema coverage is complete, but doesn't provide additional contextual meaning about how parameters interact.

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 ('research') and resource ('topic') with specific methods ('using Brave Search and Perplexity'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_trending_topics' or 'create_post', which would require more specific scope definition.

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?

The description provides no guidance on when to use this tool versus alternatives like 'get_trending_topics' for trending information or 'create_post' for content creation. There's no mention of prerequisites, limitations, or appropriate contexts for choosing this research tool over other methods.

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/tayler-id/social-media-mcp'

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