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;
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. It mentions 'comprehensive risk assessment' but doesn't specify what that entails operationally—such as data sources, computation methods, output format, or limitations. For a tool that presumably analyzes complex financial/operational data, this lack of behavioral context is a significant gap.

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 potentially benefit from slightly more detail given 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?

For a risk assessment tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the assessment returns, how results are structured, or any behavioral aspects like data freshness or limitations. Given the complexity implied by analyzing market, governance, and operational risks, more context is needed for effective agent use.

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 already documents both parameters thoroughly. The description adds minimal value beyond the schema—it implies the 'target' parameter can be companies or sectors, and lists some risk types that overlap with the enum in 'risk_types'. However, it doesn't provide additional context like examples or usage scenarios for parameters.

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: 'Comprehensive risk assessment for companies or sectors including market, governance, and operational risks.' It specifies the verb ('assessment') and resource ('companies or sectors'), and lists key risk types. However, it doesn't explicitly differentiate from sibling tools like 'get_esg_scores' or 'screen_opportunities' which might overlap in risk-related analysis.

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 doesn't mention prerequisites, context for selection, or exclusions. Given sibling tools like 'analyze_trends' or 'compare_companies', there's no indication of when this risk assessment tool is preferred over other analytical options.

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