Skip to main content
Glama

assess_investment_risk

Analyze market, governance, and operational risks for companies or sectors to support investment decisions on the Spanish stock exchange.

Instructions

Comprehensive risk assessment for companies or sectors including market, governance, and operational risks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYesCompany symbol, sector name, or portfolio of companies
risk_typesNoTypes of risk to assess

Implementation Reference

  • Core handler function implementing the investment risk assessment logic. Determines target type, evaluates specified risk categories using helper methods, calculates overall risk score, and provides recommendations.
    async assessInvestmentRisk(target: string, riskTypes: string[] = ['all']): Promise<any> { try { const riskAssessment = { target: target, assessment_date: new Date().toISOString(), risk_types_analyzed: riskTypes, overall_risk_score: 0, risk_breakdown: {}, recommendations: [] }; // Try to determine if target is a company, sector, or portfolio let targetType = 'unknown'; let targetData = null; try { targetData = await this.db.getCompanyBySymbol(target); targetType = 'company'; } catch { try { targetData = await this.db.getCompaniesBySector(target); targetType = 'sector'; } catch { // Assume it's a portfolio or custom target targetType = 'portfolio'; } } // Initialize risk_breakdown as any to allow dynamic property assignment const riskBreakdown: any = {}; // Assess different risk types if (riskTypes.includes('all') || riskTypes.includes('market_risk')) { riskBreakdown.market_risk = await this.assessMarketRisk(targetData, targetType); } if (riskTypes.includes('all') || riskTypes.includes('governance_risk')) { riskBreakdown.governance_risk = await this.assessGovernanceRisk(targetData, targetType); } if (riskTypes.includes('all') || riskTypes.includes('sector_risk')) { riskBreakdown.sector_risk = await this.assessSectorRisk(targetData, targetType); } if (riskTypes.includes('all') || riskTypes.includes('liquidity_risk')) { riskBreakdown.liquidity_risk = await this.assessLiquidityRisk(targetData, targetType); } if (riskTypes.includes('all') || riskTypes.includes('concentration_risk')) { riskBreakdown.concentration_risk = await this.assessConcentrationRisk(targetData, targetType); } riskAssessment.risk_breakdown = riskBreakdown; // Calculate overall risk score riskAssessment.overall_risk_score = this.calculateOverallRiskScore(riskAssessment.risk_breakdown); riskAssessment.recommendations = this.generateRiskRecommendations(riskAssessment.risk_breakdown); return riskAssessment; } catch (error) { throw new Error(`Risk assessment failed: ${error}`); } }
  • src/index.ts:434-456 (registration)
    Tool registration in the list of available tools, including name, description, and detailed input schema definition.
    { name: 'assess_investment_risk', description: 'Comprehensive risk assessment for companies or sectors including market, governance, and operational risks', inputSchema: { type: 'object', properties: { target: { type: 'string', description: 'Company symbol, sector name, or portfolio of companies', }, risk_types: { type: 'array', items: { type: 'string', enum: ['market_risk', 'governance_risk', 'sector_risk', 'liquidity_risk', 'concentration_risk', 'all'], }, description: 'Types of risk to assess', default: ['all'], }, }, required: ['target'], }, },
  • Tool dispatch handler in the main CallToolRequestSchema switch statement, which extracts arguments and delegates execution to the AnalyticsManager's assessInvestmentRisk method.
    case 'assess_investment_risk': result = await this.analytics.assessInvestmentRisk((args as any)?.target, (args as any)?.risk_types || ['all']); 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