Skip to main content
Glama
amittell

firewalla-mcp-server

get_target_lists

Retrieve all target lists from Firewalla to manage network security rules and monitor traffic patterns.

Instructions

Retrieve all target lists from Firewalla

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitYesMaximum number of target lists to return (required)

Implementation Reference

  • Core handler implementation for 'get_target_lists' tool. Extends BaseToolHandler, defines name, description, and execute method that validates parameters, calls firewalla.getTargetLists API, processes response with per-list target limiting to 500, and returns unified response format.
    export class GetTargetListsHandler extends BaseToolHandler {
      name = 'get_target_lists';
      description =
        'Access security target lists (CloudFlare, CrowdSec) with domains and IPs. Requires limit parameter. Data cached for 1 hour for performance.';
      category = 'rule' as const;
    
      constructor() {
        super({
          enableGeoEnrichment: false, // No IP fields in target lists metadata
          enableFieldNormalization: true,
          additionalMeta: {
            data_source: 'target_lists',
            entity_type: 'security_target_lists',
            supports_geographic_enrichment: false,
            supports_field_normalization: true,
            standardization_version: '2.0.0',
          },
        });
      }
    
      async execute(
        args: ToolArgs,
        firewalla: FirewallaClient
      ): Promise<ToolResponse> {
        // Pre-flight parameter validation - do this before timeout wrapper
        const limitValidation = ParameterValidator.validateNumber(
          args?.limit,
          'limit',
          {
            required: true,
            ...getLimitValidationConfig(this.name),
          }
        );
    
        if (!limitValidation.isValid) {
          return createErrorResponse(
            this.name,
            'Parameter validation failed',
            ErrorType.VALIDATION_ERROR,
            undefined,
            limitValidation.errors
          );
        }
    
        const limit = limitValidation.sanitizedValue! as number;
        const listType = args?.list_type as string | undefined;
    
        // Validate list_type parameter if provided
        if (listType !== undefined) {
          const validTypes = ['cloudflare', 'crowdsec', 'all'];
          if (!validTypes.includes(listType)) {
            return createErrorResponse(
              this.name,
              'Invalid list_type parameter',
              ErrorType.VALIDATION_ERROR,
              undefined,
              [`list_type must be one of: ${validTypes.join(', ')}`]
            );
          }
        }
    
        // Use timeout wrapper only for the API call and response processing
        return withToolTimeout(async () => {
          const listsResponse = await firewalla.getTargetLists(listType, limit);
    
          const startTime = Date.now();
    
          const unifiedResponseData = {
            total_lists: SafeAccess.safeArrayAccess(
              listsResponse.results,
              arr => arr.length,
              0
            ),
            limit_applied: limit,
            categories: Array.from(
              new Set(
                SafeAccess.safeArrayMap(listsResponse.results, (l: any) =>
                  SafeAccess.getNestedValue(l, 'category', undefined)
                ).filter(Boolean)
              )
            ),
            target_lists: SafeAccess.safeArrayMap(
              listsResponse.results,
              (list: any) => ({
                id: SafeAccess.getNestedValue(list, 'id', 'unknown'),
                name: SafeAccess.getNestedValue(list, 'name', 'Unknown List'),
                owner: SafeAccess.getNestedValue(list, 'owner', 'unknown'),
                category: SafeAccess.getNestedValue(list, 'category', 'unknown'),
                entry_count: SafeAccess.safeArrayAccess(
                  SafeAccess.getNestedValue(list, 'targets', []),
                  arr => arr.length,
                  0
                ),
                // Target List Buffer Strategy: Per-list target limiting
                //
                // Problem: Some target lists (especially threat intelligence feeds)
                // can contain 10,000+ targets, leading to:
                // - Excessive response payload sizes
                // - JSON serialization performance issues
                // - Client-side rendering problems
                //
                // Solution: Limit to 500 targets per list while preserving total count.
                // This balances:
                // - Useful data visibility (500 targets shows patterns/types)
                // - Response performance (manageable payload size)
                // - Client usability (reasonable display limits)
                //
                // The 500 limit was chosen as 5x the original 100 limit to provide
                // better visibility into large lists while maintaining performance.
                targets: SafeAccess.safeArrayAccess(
                  SafeAccess.getNestedValue(list, 'targets', []),
                  arr => arr.slice(0, 500), // Per-list target buffer limit
                  []
                ),
                last_updated: safeUnixToISOString(
                  SafeAccess.getNestedValue(list, 'lastUpdated', undefined) as
                    | number
                    | undefined,
                  undefined
                ),
                notes: SafeAccess.getNestedValue(list, 'notes', ''),
              })
            ),
          };
    
          const executionTime = Date.now() - startTime;
          return this.createUnifiedResponse(unifiedResponseData, {
            executionTimeMs: executionTime,
          });
        }, this.name);
      }
    }
  • MCP tool schema definition in server ListTools response, specifying inputSchema with required 'limit' parameter (1-1000).
    name: 'get_target_lists',
    description: 'Retrieve all target lists from Firewalla',
    inputSchema: {
      type: 'object',
      properties: {
        limit: {
          type: 'number',
          description:
            'Maximum number of target lists to return (required)',
          minimum: 1,
          maximum: 1000,
        },
      },
      required: ['limit'],
    },
  • ToolRegistry registers the GetTargetListsHandler instance during construction in registerHandlers() method. Also imported from './handlers/rules.js' at line 50.
    this.register(new GetTargetListsHandler());
  • src/server.ts:833-833 (registration)
    FirewallaMCPServer calls setupTools which uses ToolRegistry to connect all handlers including get_target_lists to the MCP Server.
    setupTools(this.server, this.firewalla);
  • Limit configuration for get_target_lists tool set to STANDARD_LIMITS.BASIC_QUERY (1000), used in ParameterValidator.getLimitValidationConfig.
    get_target_lists: STANDARD_LIMITS.BASIC_QUERY,
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 the action ('Retrieve') but doesn't mention whether this is a read-only operation, if it requires specific permissions, potential rate limits, or what the return format looks like (e.g., list structure, pagination). This leaves significant gaps for an agent to understand how to interact with it safely and effectively.

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 that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word earns its place, adhering to best practices for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple retrieval tool with one parameter and no output schema, the description is minimally adequate. It covers the basic purpose but lacks details on behavioral aspects like error handling, return format, or usage context. Without annotations or an output schema, the agent must infer these from the description alone, which is insufficient for full operational understanding.

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 'limit' parameter clearly documented. The description doesn't add any semantic details beyond what the schema provides, such as explaining why a limit is required or typical usage patterns. Given the high schema coverage, a baseline score of 3 is appropriate as the schema handles the parameter documentation adequately.

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 verb ('Retrieve') and resource ('all target lists from Firewalla'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_specific_target_list' or 'search_target_lists', which would require mentioning scope or filtering differences.

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 like 'get_specific_target_list' or 'search_target_lists'. It lacks context about prerequisites, such as authentication or network access, and doesn't specify scenarios where this tool is preferred over others.

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