Skip to main content
Glama
janetsep

TreePod Financial MCP Agent

by janetsep

Analizar finanzas

analyze_finances

Analyze current TreePod Glamping finances using key metrics from real data to assess business performance and identify trends.

Instructions

Analiza las finanzas actuales de TreePod Glamping con métricas clave basado en datos reales

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
periodNocurrent

Implementation Reference

  • server.js:29-58 (registration)
    Registers the analyze_finances tool with the MCP server. Defines input schema (period: string, default 'current') and handler that logs, calls businessCalculator.analyzeFinancialMetrics(period), handles errors with validator.
    // --- Herramienta: analyze_finances ---
    // ✅ IMPLEMENTA GUÍA DE TRABAJO FUNDAMENTAL: Sin hardcodeo, validación, trazabilidad
    server.registerTool(
      'analyze_finances',
      {
        title: 'Analizar finanzas',
        description: 'Analiza las finanzas actuales de TreePod Glamping con métricas clave basado en datos reales',
        inputSchema: z.object({
          period: z.string().default('current'),
        }),
      },
      async ({ period }) => {
        validator.log('info', `Iniciando análisis financiero para período: ${period}`);
        
        try {
          // Usar módulo de cálculo sin hardcodeo
          const result = await businessCalculator.analyzeFinancialMetrics(period);
          
          validator.log('info', 'Análisis financiero completado exitosamente');
          return result;
          
        } catch (error) {
          validator.log('error', `Error crítico en análisis financiero: ${error.message}`);
          return validator.generateInsufficientDataResponse(
            'análisis financiero',
            'Error interno del sistema. Contacta al administrador.'
          );
        }
      }
    );
  • Main handler logic for analyze_finances: Loads financial data from dataLoader.loadFinancialData(), validates essential fields (ingresos_total, gastos_total), computes analysis via calculateFinancialAnalysis, formats output with formatFinancialAnalysis, handles errors.
    async analyzeFinancialMetrics(period = 'current') {
      const financialData = await dataLoader.loadFinancialData();
      
      if (!financialData) {
        return validator.generateInsufficientDataResponse(
          'datos financieros',
          'No se pudo acceder a los datos financieros del sistema'
        );
      }
    
      // Verificar campos esenciales
      const requiredFields = ['ingresos_total', 'gastos_total'];
      const missingFields = requiredFields.filter(field => !(field in financialData));
      
      if (missingFields.length > 0) {
        return validator.generateInsufficientDataResponse(
          'métricas financieras',
          `Faltan datos esenciales: ${missingFields.join(', ')}`
        );
      }
    
      try {
        const analysis = this.calculateFinancialAnalysis(financialData, period);
        validator.log('info', `Análisis financiero completado para período: ${period}`);
        
        return {
          content: [{
            type: 'text',
            text: this.formatFinancialAnalysis(analysis)
          }]
        };
        
      } catch (error) {
        validator.log('error', `Error en análisis financiero: ${error.message}`);
        return validator.generateInsufficientDataResponse(
          'análisis financiero',
          'Error interno en el análisis. Contacta al administrador.'
        );
      }
    }
  • Helper method that computes key financial metrics from loaded data: revenue (ingresos), expenses (gastos), profit (utilidad), margin, occupancy, reservations, average revenue per reservation, and goal achievements.
    calculateFinancialAnalysis(data, period) {
      const ingresos = data.ingresos_total || 0;
      const gastos = data.gastos_total || 0;
      const utilidad = ingresos - gastos;
      const margen = ingresos > 0 ? ((utilidad / ingresos) * 100).toFixed(1) : 0;
      const ocupacion = data.ocupacion_promedio || 0;
      const reservas = data.reservas_totales || 0;
      
      return {
        periodo: period,
        ingresos,
        gastos,
        utilidad,
        margen,
        ocupacion,
        reservas,
        ingresoPromedioPorReserva: reservas > 0 ? Math.round(ingresos / reservas) : 0,
        metaIngresos: ingresos >= 6000000,
        metaUtilidad: utilidad >= 2000000,
        metaOcupacion: ocupacion >= 70
      };
    }
  • Helper method that formats the financial analysis into a structured text response with emojis, status indicators, key metrics, and goal achievements.
    formatFinancialAnalysis(analysis) {
      const estado = this.determineBusinessStatus(analysis);
      
      return `📊 **ANÁLISIS FINANCIERO TREEPOD GLAMPING**\n\n` +
             `📅 **Período:** ${analysis.periodo}\n` +
             `💰 **Estado General:** ${estado}\n\n` +
             `**💵 FINANZAS:**\n` +
             `• Ingresos: ${this.formatCurrency(analysis.ingresos)} ${analysis.metaIngresos ? '✅' : '⚠️'}\n` +
             `• Gastos: ${this.formatCurrency(analysis.gastos)}\n` +
             `• Utilidad: ${this.formatCurrency(analysis.utilidad)} ${analysis.metaUtilidad ? '✅' : '⚠️'}\n` +
             `• Margen: ${analysis.margen}% ${analysis.margen > 30 ? '✅' : '⚠️'}\n\n` +
             `**🏠 OPERACIONES:**\n` +
             `• Ocupación: ${analysis.ocupacion}% ${analysis.metaOcupacion ? '✅' : '⚠️'}\n` +
             `• Reservas totales: ${analysis.reservas}\n` +
             `• Ingreso promedio/reserva: ${this.formatCurrency(analysis.ingresoPromedioPorReserva)}\n\n` +
             `*Análisis basado en datos reales del sistema TreePod*`;
    }
  • Zod input schema for analyze_finances tool: period as string with default 'current'.
    inputSchema: z.object({
      period: z.string().default('current'),
    }),
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 states the tool analyzes finances with key metrics based on real data, but doesn't describe what the analysis entails (e.g., returns metrics like revenue, expenses), whether it's read-only or has side effects, or any constraints like data freshness or permissions required. For a tool with zero annotation coverage, this is a significant gap in transparency.

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

Conciseness5/5

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

The description is a single, efficient sentence in Spanish that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, with every part contributing to understanding what the tool does.

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 complexity (financial analysis tool), no annotations, no output schema, and low schema description coverage, the description is incomplete. It doesn't explain what metrics are returned, how the analysis is performed, or any behavioral traits. For a tool that likely provides detailed financial insights, more context is needed to be fully helpful.

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?

The input schema has one parameter 'period' with 0% description coverage, and the tool description doesn't mention any parameters. Since schema_description_coverage is low (<50%), the description should compensate but doesn't add any parameter information. However, with only one parameter and a default value provided in the schema, the baseline is adjusted to 3 as the minimal viable documentation, though it lacks semantic details like what 'period' values are acceptable.

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: 'Analiza las finanzas actuales de TreePod Glamping con métricas clave basado en datos reales' (Analyzes current finances of TreePod Glamping with key metrics based on real data). It specifies the verb 'analiza' (analyzes), the resource 'finanzas' (finances), and the scope 'TreePod Glamping'. However, it doesn't explicitly differentiate from sibling tools like 'get_business_status' or 'predict_revenue', which might overlap in financial analysis contexts.

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, exclusions, or compare it to siblings such as 'predict_revenue' for forecasting or 'get_business_status' for overall status checks. The context is implied (analyzing current finances), but explicit usage guidelines are missing.

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/janetsep/treepod-financial-mcp'

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