Skip to main content
Glama
amittell

firewalla-mcp-server

get_simple_statistics

Retrieve basic statistics overview for Firewalla network monitoring, including bandwidth tracking and security analysis.

Instructions

Retrieve basic statistics overview

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
groupNoGet statistics for specific box group

Implementation Reference

  • Implements the core logic for the get_simple_statistics tool. Fetches statistics from Firewalla API using firewalla.getSimpleStatistics(), processes box status, alarms, rules, calculates availability and health score, and returns unified response.
    export class GetSimpleStatisticsHandler extends BaseToolHandler {
      name = 'get_simple_statistics';
      description =
        'Get network statistics including box status, security metrics, and system health indicators.';
      category = 'analytics' as const;
    
      constructor() {
        super({
          enableGeoEnrichment: false, // No IP fields in statistics
          enableFieldNormalization: true,
          additionalMeta: {
            data_source: 'statistics',
            entity_type: 'network_statistics',
            supports_geographic_enrichment: false,
            supports_field_normalization: true,
            standardization_version: '2.0.0',
          },
        });
      }
    
      async execute(
        _args: ToolArgs,
        firewalla: FirewallaClient
      ): Promise<ToolResponse> {
        try {
          const statsResponse = await withToolTimeout(
            async () => firewalla.getSimpleStatistics(),
            this.name
          );
          const stats = SafeAccess.safeArrayAccess(
            statsResponse?.results,
            (arr: any[]) => arr[0],
            {}
          ) as any;
    
          const startTime = Date.now();
    
          const unifiedResponseData = {
            statistics: {
              online_boxes: SafeAccess.getNestedValue(
                stats,
                'onlineBoxes',
                0
              ) as number,
              offline_boxes: SafeAccess.getNestedValue(
                stats,
                'offlineBoxes',
                0
              ) as number,
              total_boxes:
                (SafeAccess.getNestedValue(stats, 'onlineBoxes', 0) as number) +
                (SafeAccess.getNestedValue(stats, 'offlineBoxes', 0) as number),
              total_alarms: SafeAccess.getNestedValue(stats, 'alarms', 0) as number,
              total_rules: SafeAccess.getNestedValue(stats, 'rules', 0) as number,
              box_availability: this.calculateBoxAvailability(stats),
            },
            summary: {
              status:
                (SafeAccess.getNestedValue(stats, 'onlineBoxes', 0) as number) > 0
                  ? 'operational'
                  : 'offline',
              health_score: this.calculateHealthScore(stats),
              active_monitoring:
                (SafeAccess.getNestedValue(stats, 'onlineBoxes', 0) as number) > 0,
            },
          };
    
          const executionTime = Date.now() - startTime;
    
          return this.createUnifiedResponse(unifiedResponseData, {
            executionTimeMs: executionTime,
          });
        } catch (error: unknown) {
          const errorMessage =
            error instanceof Error ? error.message : 'Unknown error occurred';
          return this.createErrorResponse(
            `Failed to get simple statistics: ${errorMessage}`,
            ErrorType.API_ERROR
          );
        }
      }
    
      private calculateBoxAvailability(stats: any): number {
        const onlineBoxes = SafeAccess.getNestedValue(
          stats,
          'onlineBoxes',
          0
        ) as number;
        const offlineBoxes = SafeAccess.getNestedValue(
          stats,
          'offlineBoxes',
          0
        ) as number;
        const totalBoxes = onlineBoxes + offlineBoxes;
        return totalBoxes > 0 ? Math.round((onlineBoxes / totalBoxes) * 100) : 0;
      }
    
      private calculateHealthScore(stats: any): number {
        let score = 100;
    
        const onlineBoxes = SafeAccess.getNestedValue(
          stats,
          'onlineBoxes',
          0
        ) as number;
        const offlineBoxes = SafeAccess.getNestedValue(
          stats,
          'offlineBoxes',
          0
        ) as number;
        const alarms = SafeAccess.getNestedValue(stats, 'alarms', 0) as number;
        const rules = SafeAccess.getNestedValue(stats, 'rules', 0) as number;
    
        const totalBoxes = onlineBoxes + offlineBoxes;
        if (totalBoxes === 0) {
          return 0;
        }
    
        // Penalize for offline boxes (up to -40 points)
        const offlineRatio = offlineBoxes / totalBoxes;
        score -= Math.round(offlineRatio * 40);
    
        // Penalize for high alarm count (up to -30 points)
        const alarmPenalty = Math.min(alarms * 2, 30);
        score -= alarmPenalty;
    
        // Bonus for having active rules (up to +10 points)
        const ruleBonus = Math.min(rules / 10, 10);
        score += ruleBonus;
    
        return Math.max(0, Math.min(100, score));
      }
    }
  • Defines the input schema for the get_simple_statistics tool in the ListToolsRequestSchema handler, specifying optional 'group' parameter.
    {
      name: 'get_simple_statistics',
      description: 'Retrieve basic statistics overview',
      inputSchema: {
        type: 'object',
        properties: {
          group: {
            type: 'string',
            description: 'Get statistics for specific box group',
          },
        },
        required: [],
      },
  • Registers the GetSimpleStatisticsHandler instance in the ToolRegistry during initialization.
    this.register(new GetSimpleStatisticsHandler());
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'retrieve' which implies a read-only operation, but doesn't cover critical aspects like authentication needs, rate limits, error handling, or what the output format looks like (e.g., summary vs. detailed data). This leaves significant gaps for safe and effective use.

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 with no wasted words, making it easy to parse. However, it's overly brief and could benefit from more detail to improve clarity without sacrificing conciseness, as it currently under-specifies the tool's scope.

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 lack of annotations and output schema, the description is incomplete for a tool that likely returns complex statistics data. It doesn't explain what 'basic statistics' entails, how results are structured, or any behavioral constraints, making it inadequate for reliable agent operation without additional context.

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 100% description coverage, with the 'group' parameter documented as 'Get statistics for specific box group'. The description adds no additional parameter information beyond this, so it doesn't compensate but also doesn't detract, meeting the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Retrieve basic statistics overview' clearly states the action (retrieve) and resource (statistics overview), making the purpose understandable. However, it lacks specificity about what 'basic statistics' includes and doesn't differentiate from sibling tools like 'get_statistics_by_box' or 'get_statistics_by_region', leaving ambiguity about scope.

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?

No guidance is provided on when to use this tool versus alternatives such as 'get_statistics_by_box' or 'get_statistics_by_region'. The description implies a general overview but doesn't specify use cases, prerequisites, or exclusions, leaving the agent to guess based on tool names alone.

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/amittell/firewalla-mcp-server'

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