Skip to main content
Glama

compare_companies

Analyze and compare multiple companies across financial, governance, and market performance metrics to evaluate their relative strengths and positions.

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

  • The core handler function that implements the compare_companies tool logic. It fetches company data, directors, shareholders, historical prices, and news for each input company, computes performance metrics and risk profiles, and generates a comparison summary and 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}`); } }
  • src/index.ts:380-404 (registration)
    Registration of the compare_companies tool in the MCP server's list of tools, including the name, description, and input schema definition.
    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'], }, },
  • Dispatch handler in the MCP server's CallToolRequest handler that routes the compare_companies tool call to the AnalyticsManager's compareCompanies method.
    case 'compare_companies': result = await this.analytics.compareCompanies((args as any)?.companies, (args as any)?.metrics || ['all']); break;
  • Input schema definition for the compare_companies tool, specifying the expected parameters: companies (array of strings, required) and metrics (array of strings with enum, optional).
    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'], },

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