Skip to main content
Glama

compare_companies

Analyze and compare multiple companies across financial, governance, and market performance metrics to evaluate relationships in the Spanish stock exchange.

Instructions

Compare multiple companies across various metrics (financial, governance, market performance)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
companiesYesList of company symbols or names to compare
metricsNoMetrics to compare (defaults to all if not specified)

Implementation Reference

  • Core handler implementing company comparison by fetching comprehensive data (financials, governance, market performance, news) for each company and generating analytical summary and investment recommendations.
    async compareCompanies(companies: string[], metrics: string[] = ['all']): Promise<any> {
      try {
        const companyData = [];
        
        for (const companyInput of companies) {
          try {
            const company = await this.db.getCompanyBySymbol(companyInput);
            if (company) {
              const directors = await this.db.getCompanyDirectors(company.id);
              const shareholders = await this.db.getCompanyShareholders(company.id);
              const historical = await this.db.getHistoricalPrices(company.id, 30);
              const news = await this.db.getRecentNews(company.id, 5);
              
              companyData.push({
                basic_info: company,
                directors: directors.length,
                shareholders: shareholders.length,
                recent_performance: historical.length > 1 ? this.calculatePerformance(historical) : null,
                news_coverage: news.length,
                risk_profile: this.assessCompanyRisk(company, directors)
              });
            }
          } catch (error) {
            companyData.push({
              symbol: companyInput,
              error: `Could not find or analyze company: ${error}`
            });
          }
        }
    
        // Generate comparison analysis
        const comparison = {
          companies_compared: companyData.length,
          comparison_date: new Date().toISOString(),
          metrics_analyzed: metrics,
          detailed_comparison: companyData,
          summary: this.generateComparisonSummary(companyData),
          recommendations: this.generateComparisonRecommendations(companyData)
        };
    
        return comparison;
      } catch (error) {
        throw new Error(`Company comparison failed: ${error}`);
      }
    }
  • Input schema definition for the compare_companies tool, specifying required companies array and optional metrics enum.
    {
      name: 'compare_companies',
      description: 'Compare multiple companies across various metrics (financial, governance, market performance)',
      inputSchema: {
        type: 'object',
        properties: {
          companies: {
            type: 'array',
            items: {
              type: 'string',
            },
            description: 'List of company symbols or names to compare',
          },
          metrics: {
            type: 'array',
            items: {
              type: 'string',
              enum: ['financial', 'governance', 'market_performance', 'sector_position', 'risk_profile', 'all'],
            },
            description: 'Metrics to compare (defaults to all if not specified)',
            default: ['all'],
          },
        },
        required: ['companies'],
      },
    },
  • src/index.ts:661-663 (registration)
    Tool registration in the CallToolRequestSchema handler switch statement, dispatching calls to the analytics manager's compareCompanies method.
    case 'compare_companies':
      result = await this.analytics.compareCompanies((args as any)?.companies, (args as any)?.metrics || ['all']);
      break;
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 of behavioral disclosure. It mentions the tool compares companies across metrics but does not specify how the comparison is performed (e.g., side-by-side table, aggregated scores), what the output format is, or any limitations (e.g., number of companies, data freshness). For a tool with no annotations, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. It avoids redundancy and wastes no words, though it could be slightly more structured by separating key points. Overall, it is appropriately sized for the tool's complexity.

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?

Given the tool has no annotations, no output schema, and involves comparing multiple companies across metrics, the description is incomplete. It does not explain the comparison output format, potential limitations, or how results are presented, which are critical for an agent to use the tool effectively. The high schema coverage helps, but behavioral aspects are under-specified.

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 the parameters 'companies' and 'metrics' with descriptions and defaults. The description adds minimal value beyond the schema by listing example metric types (financial, governance, market performance), but it does not provide additional context like metric definitions or comparison methodology. This meets the baseline for high schema coverage.

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: comparing multiple companies across various metrics. It specifies the verb 'compare' and the resources 'companies' and 'metrics' (financial, governance, market performance). However, it does not explicitly differentiate from sibling tools like 'get_sector_correlation_analysis' or 'screen_opportunities', which might also involve comparisons, so it falls short of a perfect score.

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. It does not mention sibling tools or contexts where this tool is preferred, such as for multi-company analysis versus single-company tools like 'get_company_by_symbol'. Without any usage context or exclusions, the agent must infer when to apply it.

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

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