Skip to main content
Glama
janetsep

TreePod Financial MCP Agent

by janetsep

Optimizar precios

optimize_pricing

Analyze competitor pricing and occupancy data to suggest revenue-optimizing price adjustments for TreePod Glamping.

Instructions

Sugiere optimizaciones de precios basado en competencia y ocupación usando datos reales

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
strategyNomaximize_revenue

Implementation Reference

  • server.js:262-302 (registration)
    MCP tool registration for 'optimize_pricing', including schema, title, description, and thin handler that validates input and delegates to businessCalculator.optimizePricing
    server.registerTool(
      'optimize_pricing',
      {
        title: 'Optimizar precios',
        description: 'Sugiere optimizaciones de precios basado en competencia y ocupación usando datos reales',
        inputSchema: z.object({
          strategy: z.string().default('maximize_revenue'),
        }),
      },
      async ({ strategy = 'maximize_revenue' }) => {
        validator.log('info', `Iniciando optimización de precios con estrategia: ${strategy}`);
        
        try {
          // Validar parámetros de entrada
          const inputValidation = validator.validateUserInput({
            strategy
          }, {
            strategy: { required: true, type: 'string', enum: ['maximize_revenue', 'maximize_occupancy', 'balanced', 'competitive'] }
          });
    
          if (!inputValidation.valid) {
            return validator.generateInsufficientDataResponse(
              'estrategia de optimización',
              `Errores: ${inputValidation.errors.join(', ')}`
            );
          }
          
          const result = await businessCalculator.optimizePricing(strategy);
          
          validator.log('info', 'Optimización de precios completada exitosamente');
          return result;
          
        } catch (error) {
          validator.log('error', `Error crítico en optimización de precios: ${error.message}`);
          return validator.generateInsufficientDataResponse(
            'optimización de precios',
            'Error interno del sistema. Contacta al administrador.'
          );
        }
      }
    );
  • Input schema using Zod: strategy string defaulting to 'maximize_revenue'
      inputSchema: z.object({
        strategy: z.string().default('maximize_revenue'),
      }),
    },
  • Core handler logic in BusinessCalculator.optimizePricing: loads real data sources, computes pricing optimization based on strategy, formats response
    async optimizePricing(strategy) {
      validator.log('info', `Iniciando optimización de precios con estrategia: ${strategy}`);
      
      try {
        // Cargar datos reales necesarios
        const financialData = await dataLoader.loadFinancialData();
        const businessData = await dataLoader.loadBusinessStatus();
        const competitionData = await dataLoader.loadCompetitionData();
        
        // Validar que tenemos datos suficientes
        if (!financialData && !businessData) {
          return validator.generateInsufficientDataResponse(
            'datos para optimización de precios',
            'No se pudo acceder a los datos financieros ni de estado del negocio'
          );
        }
        
        const optimization = this.calculatePricingOptimization(
          strategy, 
          financialData, 
          businessData, 
          competitionData
        );
        
        return {
          content: [{
            type: 'text',
            text: this.formatPricingOptimization(optimization, strategy)
          }]
        };
        
      } catch (error) {
        validator.log('error', `Error en optimización de precios: ${error.message}`);
        return validator.generateInsufficientDataResponse(
          'optimización de precios',
          'Error interno en el análisis. Contacta al administrador.'
        );
      }
    }
  • Helper that performs the pricing optimization calculation based on strategy and loaded data, populates recommendation structure
    calculatePricingOptimization(strategy, financialData, businessData, competitionData) {
      const currentOccupancy = financialData?.ocupacion_promedio || businessData?.occupancy || 0;
      const currentRevenue = financialData?.ingresos_total || 0;
      const averageRate = currentRevenue > 0 && financialData?.reservas_totales > 0 
        ? Math.round(currentRevenue / financialData.reservas_totales) 
        : 0;
      
      const optimization = {
        strategy,
        current_metrics: {
          occupancy: currentOccupancy,
          revenue: currentRevenue,
          average_rate: averageRate
        },
        recommendations: [],
        price_adjustments: [],
        expected_impact: {},
        implementation_steps: [],
        monitoring_kpis: []
      };
      
      // Análisis por estrategia
      switch (strategy) {
        case 'maximize_revenue':
          this.addRevenueMaximizationStrategy(optimization, currentOccupancy);
          break;
        case 'maximize_occupancy':
          this.addOccupancyMaximizationStrategy(optimization, currentOccupancy);
          break;
        case 'balanced':
          this.addBalancedStrategy(optimization, currentOccupancy);
          break;
        case 'competitive':
          this.addCompetitiveStrategy(optimization, competitionData);
          break;
        default:
          optimization.recommendations.push('Estrategia no reconocida, aplicando estrategia balanceada');
          this.addBalancedStrategy(optimization, currentOccupancy);
      }
      
      // Agregar consideraciones generales
      this.addGeneralPricingConsiderations(optimization);
      
      return optimization;
    }
  • Helper to format the pricing optimization results into a structured text report for MCP response
    formatPricingOptimization(optimization, strategy) {
      const strategyNames = {
        maximize_revenue: 'Maximizar Ingresos',
        maximize_occupancy: 'Maximizar Ocupación', 
        balanced: 'Estrategia Balanceada',
        competitive: 'Estrategia Competitiva'
      };
      
      let report = `💰 **OPTIMIZACIÓN DE PRECIOS TREEPOD**\n\n`;
      report += `🎯 **Estrategia:** ${strategyNames[strategy] || strategy}\n\n`;
      
      // Métricas actuales
      report += `📊 **MÉTRICAS ACTUALES:**\n`;
      report += `• Ocupación: ${optimization.current_metrics.occupancy}%\n`;
      if (optimization.current_metrics.revenue > 0) {
        report += `• Ingresos: ${this.formatCurrency(optimization.current_metrics.revenue)}\n`;
      }
      if (optimization.current_metrics.average_rate > 0) {
        report += `• Tarifa promedio: ${this.formatCurrency(optimization.current_metrics.average_rate)}\n`;
      }
      report += `\n`;
      
      // Recomendaciones
      report += `🎯 **RECOMENDACIONES:**\n`;
      optimization.recommendations.forEach(rec => {
        report += `• ${rec}\n`;
      });
      report += `\n`;
      
      // Ajustes de precios
      if (optimization.price_adjustments.length > 0) {
        report += `💲 **AJUSTES SUGERIDOS:**\n`;
        optimization.price_adjustments.forEach(adj => {
          report += `• ${adj}\n`;
        });
        report += `\n`;
      }
      
      // Impacto esperado
      if (Object.keys(optimization.expected_impact).length > 0) {
        report += `📈 **IMPACTO ESPERADO:**\n`;
        if (optimization.expected_impact.revenue) {
          report += `• Ingresos: ${optimization.expected_impact.revenue}\n`;
        }
        if (optimization.expected_impact.occupancy) {
          report += `• Ocupación: ${optimization.expected_impact.occupancy}\n`;
        }
        report += `\n`;
      }
      
      // Pasos de implementación
      if (optimization.implementation_steps.length > 0) {
        report += `🔧 **IMPLEMENTACIÓN:**\n`;
        optimization.implementation_steps.forEach((step, index) => {
          report += `${index + 1}. ${step}\n`;
        });
        report += `\n`;
      }
      
      // KPIs de monitoreo
      if (optimization.monitoring_kpis.length > 0) {
        report += `📊 **KPIS A MONITOREAR:**\n`;
        optimization.monitoring_kpis.forEach(kpi => {
          report += `• ${kpi}\n`;
        });
      }
      
      return report;
    }
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 'suggests' optimizations based on data, implying it's a read-only or analytical operation, but doesn't clarify if it performs calculations, requires specific permissions, has rate limits, or what the output format might be. For a tool with no annotations, this is insufficient to understand its behavior beyond a vague high-level purpose.

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 function. It's front-loaded with the core purpose and includes key factors (competition and occupancy) without unnecessary details. Every word contributes to understanding the tool's intent, making it highly concise and well-structured.

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 of a pricing optimization tool with no annotations, no output schema, and minimal parameter documentation, the description is incomplete. It lacks details on how optimizations are generated, what data inputs are needed beyond implied factors, and what the output entails. For a tool that likely involves analytical processing, this leaves significant gaps for an agent to use it effectively.

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 ('strategy') with 0% description coverage, and the tool description adds no information about parameters. Since there's only one parameter, the baseline is higher, but the description doesn't compensate for the lack of schema details. It implies the tool uses competition and occupancy data, but doesn't explain how these relate to the 'strategy' parameter or other inputs.

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: 'Sugiere optimizaciones de precios' (suggests price optimizations) based on competition and occupancy using real data. It specifies the verb 'sugiere' (suggests) and the resource 'optimizaciones de precios' (price optimizations), but doesn't explicitly differentiate it from sibling tools like 'calculate_tariff' or 'predict_revenue', which might have overlapping functionality.

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 mentions the factors used (competition and occupancy) but doesn't specify scenarios where it's preferred over siblings like 'compare_competition' or 'check_occupancy', nor does it mention prerequisites or exclusions. This leaves the agent with minimal context for tool selection.

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