Skip to main content
Glama

generate_analyst_report

Generate comprehensive analyst reports for Spanish stock exchange companies, sectors, or market themes with data visualizations and multiple analysis types.

Instructions

Generate a comprehensive analyst report for a company, sector, or market theme

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subjectYesCompany symbol, sector name, or theme to analyze
report_typeYesType of report to generate
include_chartsNoWhether to include data visualizations (text-based)

Implementation Reference

  • The main handler function that executes the generate_analyst_report tool logic. It generates comprehensive reports based on the subject (company/sector) and report_type, fetching data from DB and other analytics methods.
    async generateAnalystReport(subject: string, reportType: string, includeCharts: boolean = true): Promise<any> {
      try {
        const report = {
          subject: subject,
          report_type: reportType,
          generated_date: new Date().toISOString(),
          executive_summary: '',
          sections: {},
          charts: includeCharts ? [] : null,
          conclusions: [],
          recommendations: []
        };
    
        switch (reportType) {
          case 'company_deep_dive':
            const company = await this.db.getCompanyBySymbol(subject);
            if (!company) throw new Error(`Company ${subject} not found`);
    
            report.sections = {
              company_overview: company,
              financial_metrics: {
                market_cap: company.market_cap,
                pe_ratio: company.price_to_earnings || company.pe_ratio,
                sector: company.sector
              },
              governance_analysis: await this.getCompanyGovernanceAnalysis(company),
              market_position: await this.getCompanyMarketPosition(company),
              risk_assessment: await this.assessInvestmentRisk(subject),
              recent_developments: await this.db.getRecentNews(company.id, 10)
            };
            
            report.executive_summary = this.generateCompanyExecutiveSummary(report.sections);
            break;
    
          case 'sector_overview':
            const sectorCompanies = await this.db.getCompaniesBySector(subject);
            const sectorAnalysis = await this.getSectorCorrelationAnalysis(30);
    
            report.sections = {
              sector_overview: {
                sector_name: subject,
                company_count: sectorCompanies.length,
                total_market_cap: sectorCompanies.reduce((sum, c) => sum + (c.market_cap || 0), 0)
              },
              performance_analysis: sectorAnalysis,
              key_players: sectorCompanies.slice(0, 10),
              market_trends: await this.analyzeTrends('sector_trend', subject, 30),
              competitive_landscape: await this.analyzeSectorCompetition(sectorCompanies)
            };
            break;
    
          // Add other report types as needed
          default:
            throw new Error(`Unknown report type: ${reportType}`);
        }
    
        report.conclusions = this.generateReportConclusions(report);
        report.recommendations = this.generateReportRecommendations(report);
    
        return report;
      } catch (error) {
        throw new Error(`Report generation failed: ${error}`);
      }
    }
  • src/index.ts:458-480 (registration)
    Registers the 'generate_analyst_report' tool in the MCP server's listTools handler, including name, description, and input schema.
      name: 'generate_analyst_report',
      description: 'Generate a comprehensive analyst report for a company, sector, or market theme',
      inputSchema: {
        type: 'object',
        properties: {
          subject: {
            type: 'string',
            description: 'Company symbol, sector name, or theme to analyze',
          },
          report_type: {
            type: 'string',
            enum: ['company_deep_dive', 'sector_overview', 'governance_analysis', 'market_opportunity', 'risk_assessment'],
            description: 'Type of report to generate',
          },
          include_charts: {
            type: 'boolean',
            description: 'Whether to include data visualizations (text-based)',
            default: true,
          },
        },
        required: ['subject', 'report_type'],
      },
    },
  • The dispatch handler in the main CallToolRequestSchema that validates input via args and delegates to the analytics handler.
    case 'generate_analyst_report':
      result = await this.analytics.generateAnalystReport(
        (args as any)?.subject,
        (args as any)?.report_type,
        (args as any)?.include_charts !== false
      );
      break;

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/anbrme/ibex35-mcp-server'

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