Skip to main content
Glama
vespo92

OPNSense MCP Server

haproxy_frontend_create

Create and configure a new HAProxy frontend on OPNSense MCP Server by specifying bind address, SSL settings, mode, backend, and access control lists for efficient traffic management.

Instructions

Create a new HAProxy frontend

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aclsNoAccess control lists
backendYesDefault backend name
bindYesBind address (e.g., 0.0.0.0:443)
certificatesNoCertificate UUIDs or names
descriptionNo
modeYesFrontend mode
nameYesFrontend name
sslNoEnable SSL

Implementation Reference

  • Main handler function that implements the logic to create a HAProxy frontend. Posts configuration to OPNsense API, handles associated ACLs and actions, and triggers reconfiguration.
    async createFrontend(frontend: Omit<HAProxyFrontend, 'uuid'>): Promise<{ uuid: string }> {
      try {
        const payload = this.buildFrontendPayload(frontend);
        const response = await this.client.post('/haproxy/settings/addFrontend', payload);
        
        if (!response.uuid) {
          throw new Error('No UUID returned from create frontend');
        }
    
        // Add ACLs if provided
        if (frontend.acls && frontend.acls.length > 0) {
          for (const acl of frontend.acls) {
            await this.addACLToFrontend(response.uuid, acl);
          }
        }
    
        // Add actions if provided
        if (frontend.actions && frontend.actions.length > 0) {
          for (const action of frontend.actions) {
            await this.addActionToFrontend(response.uuid, action);
          }
        }
    
        await this.reconfigure();
        return { uuid: response.uuid };
      } catch (error) {
        throw new Error(`Failed to create HAProxy frontend: ${error}`);
      }
  • Input schema/interface defining the structure for HAProxy frontend configuration, used by the createFrontend handler.
    export interface HAProxyFrontend {
      uuid?: string;
      name: string;
      bind: string;
      bindOptions?: {
        ssl?: boolean;
        certificates?: string[];
      };
      mode: 'http' | 'tcp';
      backend: string;
      acls?: HAProxyACL[];
      actions?: HAProxyAction[];
      description?: string;
      enabled?: boolean;
    }
  • Helper function to build the API payload from frontend configuration object.
    private buildFrontendPayload(frontend: HAProxyFrontend): any {
      const payload: any = {
        frontend: {
          name: frontend.name,
          bind: frontend.bind,
          mode: frontend.mode,
          defaultBackend: frontend.backend,
          description: frontend.description || '',
          enabled: frontend.enabled !== false ? '1' : '0'
        }
      };
    
      if (frontend.bindOptions?.ssl) {
        payload.frontend.ssl = '1';
        if (frontend.bindOptions.certificates && frontend.bindOptions.certificates.length > 0) {
          payload.frontend.certificates = frontend.bindOptions.certificates.join(',');
        }
      }
    
      return payload;
  • Helper function to parse API response data into HAProxyFrontend object.
    private parseFrontend(data: any): HAProxyFrontend {
      return {
        uuid: data.uuid,
        name: data.name,
        bind: data.bind || '',
        mode: data.mode || 'http',
        backend: data.defaultBackend || '',
        description: data.description,
        enabled: data.enabled === '1',
        acls: [],
        actions: [],
        bindOptions: {
          ssl: data.ssl === '1',
          certificates: data.certificates ? data.certificates.split(',') : []
        }
      };
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. 'Create' implies a write/mutation operation, but it doesn't disclose behavioral traits like whether this requires admin permissions, if it's idempotent, what happens on duplicate names, or if changes take effect immediately. For a creation 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 with zero waste. It's appropriately sized and front-loaded, stating the core purpose immediately without unnecessary elaboration.

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 creation tool with 8 parameters, no annotations, and no output schema, the description is incomplete. It doesn't address what the tool returns (e.g., success confirmation, frontend ID), error conditions, or operational impact. The high schema coverage helps, but the description alone lacks sufficient context for safe and effective 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 high at 88%, so most parameters are documented in the schema itself. The description adds no additional parameter semantics beyond implying 'new' creation. It doesn't explain relationships between parameters (e.g., how 'ssl' interacts with 'certificates') or provide examples. Baseline 3 is appropriate when the schema does the heavy lifting.

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 'Create a new HAProxy frontend' clearly states the action (create) and resource (HAProxy frontend), which is specific and unambiguous. However, it doesn't differentiate from sibling tools like haproxy_backend_create or haproxy_certificate_create, which would require mentioning what distinguishes a frontend from other HAProxy components.

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. There's no mention of prerequisites (e.g., needing a backend first), when not to use it, or how it relates to sibling tools like haproxy_frontend_list or haproxy_frontend_delete. The agent must infer usage from the name 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

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