Skip to main content
Glama
vespo92

OPNSense MCP Server

haproxy_stats

Retrieve HAProxy statistics for monitoring and optimizing load balancing performance on the OPNSense MCP Server. Supports efficient management of network traffic and firewall configurations.

Instructions

Get HAProxy statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Type definition (schema) for HAProxy statistics data structure.
    export interface HAProxyStats {
      frontends: {
        [name: string]: {
          status: string;
          sessions: number;
          bytesIn: number;
          bytesOut: number;
          requestRate: number;
          errorRate: number;
        };
      };
      backends: {
        [name: string]: {
          status: string;
          activeServers: number;
          backupServers: number;
          sessions: number;
          queuedRequests: number;
          health: {
            [serverName: string]: {
              status: 'up' | 'down' | 'maint';
              lastCheck: string;
              weight: number;
              checksPassed: number;
              checksFailed: number;
            };
          };
        };
      };
    }
  • Core handler function that fetches HAProxy statistics from the OPNsense API endpoint '/haproxy/stats/show' and parses the response.
    async getStats(): Promise<HAProxyStats> {
      try {
        const response = await this.client.get('/haproxy/stats/show');
        return this.parseStats(response);
      } catch (error) {
        throw new Error(`Failed to get HAProxy stats: ${error}`);
      }
    }
  • Helper function to parse raw HAProxy stats data into the structured HAProxyStats format.
    private parseStats(data: any): HAProxyStats {
      const stats: HAProxyStats = {
        frontends: {},
        backends: {}
      };
    
      // Parse the stats data from HAProxy
      // This would need to be implemented based on the actual response format
      // For now, returning a basic structure
      if (data.stats) {
        // Parse frontend stats
        if (data.stats.frontends) {
          for (const [name, frontendData] of Object.entries(data.stats.frontends)) {
            stats.frontends[name] = {
              status: (frontendData as any).status || 'unknown',
              sessions: (frontendData as any).scur || 0,
              bytesIn: (frontendData as any).bin || 0,
              bytesOut: (frontendData as any).bout || 0,
              requestRate: (frontendData as any).req_rate || 0,
              errorRate: (frontendData as any).ereq || 0
            };
          }
        }
    
        // Parse backend stats
        if (data.stats.backends) {
          for (const [name, backendData] of Object.entries(data.stats.backends)) {
            const backend = backendData as any;
            stats.backends[name] = {
              status: backend.status || 'unknown',
              activeServers: backend.act || 0,
              backupServers: backend.bck || 0,
              sessions: backend.scur || 0,
              queuedRequests: backend.qcur || 0,
              health: {}
            };
    
            // Parse server health
            if (backend.servers) {
              for (const [serverName, serverData] of Object.entries(backend.servers)) {
                const server = serverData as any;
                stats.backends[name].health[serverName] = {
                  status: server.status === 'UP' ? 'up' : server.status === 'DOWN' ? 'down' : 'maint',
                  lastCheck: server.check_status || '',
                  weight: server.weight || 0,
                  checksPassed: server.chkpass || 0,
                  checksFailed: server.chkfail || 0
                };
              }
            }
          }
        }
      }
    
      return stats;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states 'Get' implies a read operation, but doesn't disclose behavioral traits such as whether it requires authentication, has rate limits, returns real-time or historical data, or if it's safe for frequent use. This leaves significant gaps in understanding how the tool behaves.

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 could be slightly improved by front-loading more specific details, but its brevity is appropriate for the simple purpose stated.

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 HAProxy systems and no output schema, the description is incomplete. It doesn't explain what statistics are returned (e.g., metrics format, data types) or how to interpret them, which is crucial for an agent to use the tool effectively in a network management context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description doesn't add parameter semantics, but this is acceptable given the lack of parameters, aligning with the baseline for zero parameters.

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 'Get HAProxy statistics' clearly states the verb 'Get' and resource 'HAProxy statistics', making the purpose understandable. However, it lacks specificity about what statistics are retrieved (e.g., performance metrics, configuration status) and doesn't distinguish from sibling tools like haproxy_backend_list or haproxy_frontend_list, which might provide overlapping or related information.

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. With siblings like haproxy_backend_list and haproxy_frontend_list, the description doesn't clarify if this tool aggregates broader statistics or serves a different purpose, leaving the agent to guess based on context.

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

Related 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/vespo92/OPNSenseMCP'

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