Skip to main content
Glama
packetracer

Palo Alto Networks MCP Server Suite

by packetracer

list_resources

Retrieve specific Palo Alto Networks firewall resources by category and type for management tasks.

Instructions

List resources from a specific category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesResource category to list
resource_typeYesSpecific resource type within the category

Implementation Reference

  • The main handler for the 'list_resources' tool. Validates input arguments using isListResourcesArgs, verifies the resource_type exists in the specified category's list, makes an API call to `/Objects/${resource_type}` on the Palo Alto firewall, and returns the JSON response as text content.
    case 'list_resources': {
        const rawArgs = request.params.arguments;
        if (!isListResourcesArgs(rawArgs)) {
            throw new McpError(
                ErrorCode.InvalidParams, 
                'Invalid arguments for list_resources'
            );
        }
    
        const { category, resource_type } = rawArgs;
    
        const categoryResources = RESOURCE_CATEGORIES[category];
        if (!categoryResources.includes(resource_type)) {
            throw new McpError(
                ErrorCode.InvalidParams, 
                `Invalid resource type for category ${category}: ${resource_type}`
            );
        }
    
        const response = await this.axiosInstance.get(`/Objects/${resource_type}`);
        return {
            content: [
                {
                    type: 'text',
                    text: JSON.stringify(response.data, null, 2),
                },
            ],
        };
    }
  • TypeScript interface defining the expected input shape for the list_resources tool arguments.
    interface ListResourcesArgs {
        category: keyof ResourceCategories;
        resource_type: string;
    }
  • src/index.ts:141-158 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining name, description, and inputSchema with validation for category (enum from RESOURCE_CATEGORIES keys) and resource_type.
        name: 'list_resources',
        description: 'List resources from a specific category',
        inputSchema: {
            type: 'object',
            properties: {
                category: {
                    type: 'string',
                    enum: Object.keys(RESOURCE_CATEGORIES),
                    description: 'Resource category to list'
                },
                resource_type: {
                    type: 'string',
                    description: 'Specific resource type within the category'
                }
            },
            required: ['category', 'resource_type']
        }
    },
  • Type guard helper function used to validate that arguments match ListResourcesArgs shape and category is a valid key in RESOURCE_CATEGORIES.
    function isListResourcesArgs(args: unknown): args is ListResourcesArgs {
        if (typeof args !== 'object' || args === null) return false;
        const typedArgs = args as Record<string, unknown>;
        return (
            typeof typedArgs.category === 'string' && 
            typeof typedArgs.resource_type === 'string' &&
            Object.keys(RESOURCE_CATEGORIES).includes(typedArgs.category as string)
        );
    }
  • Constant defining all available resource categories and their supported resource_types, used for validation in schema enum, arg validation, and handler checks.
    const RESOURCE_CATEGORIES: ResourceCategories = {
        OBJECTS: [
            'Addresses', 'AddressGroups', 'Regions', 'DynamicUserGroups', 
            'Applications', 'ApplicationGroups', 'ApplicationFilters', 
            'Services', 'ServiceGroups', 'Tags', 'GlobalProtectHIPObjects',
            'GlobalProtectHIPProfiles', 'ExternalDynamicLists', 
            'CustomDataPatterns', 'CustomSpywareSignatures', 
            'CustomVulnerabilitySignatures', 'CustomURLCategories',
            'AntivirusSecurityProfiles', 'AntiSpywareSecurityProfiles',
            'VulnerabilityProtectionSecurityProfiles', 
            'URLFilteringSecurityProfiles', 'FileBlockingSecurityProfiles',
            'WildFireAnalysisSecurityProfiles', 'DataFilteringSecurityProfiles',
            'DoSProtectionSecurityProfiles', 'SecurityProfileGroups',
            'LogForwardingProfiles', 'AuthenticationEnforcements', 
            'DecryptionProfiles', 'PacketBrokerProfiles', 
            'SDWANPathQualityProfiles', 'SDWANTrafficDistributionProfiles',
            'SDWANSaasQualityProfiles', 'SDWANErrorCorrection', 'Schedules'
        ],
        POLICIES: [
            'SecurityRules', 'NATRules', 'QoSRules', 
            'PolicyBasedForwardingRules', 'DecryptionRules', 
            'NetworkPacketBrokerRules', 'TunnelInspectionRules', 
            'ApplicationOverrideRules', 'AuthenticationRules', 
            'DoSRules', 'SDWANRules'
        ],
        NETWORK: [
            'EthernetInterfaces', 'AggregateEthernetInterfaces', 
            'VLANInterfaces', 'LoopbackInterfaces', 'TunnelIntefaces', 
            'SDWANInterfaces', 'Zones', 'VLANs', 'VirtualWires', 
            'VirtualRouters', 'IPSecTunnels', 'GRETunnels', 
            'DHCPServers', 'DHCPRelays', 'DNSProxies', 
            'GlobalProtectPortals', 'GlobalProtectGateways', 
            'GlobalProtectGatewayAgentTunnels', 
            'GlobalProtectGatewaySatelliteTunnels', 
            'GlobalProtectGatewayMDMServers', 
            'GlobalProtectClientlessApps', 
            'GlobalProtectClientlessAppGroups', 
            'QoSInterfaces', 'LLDP', 
            'GlobalProtectIPSecCryptoNetworkProfiles', 
            'IKEGatewayNetworkProfiles', 'IKECryptoNetworkProfiles', 
            'MonitorNetworkProfiles', 
            'InterfaceManagementNetworkProfiles', 
            'ZoneProtectionNetworkProfiles', 'QoSNetworkProfiles', 
            'LLDPNetworkProfiles', 'BFDNetworkProfiles', 
            'SDWANInterfaceProfiles'
        ],
        DEVICES: [
            'VirtualSystems', 'SNMPTrapServerProfiles', 
            'SyslogServerProfiles', 'EmailServerProfiles', 
            'HttpServerProfiles', 'LDAPServerProfiles'
        ]
    };

Tool Definition Quality

Score is being calculated. Check back soon.

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/packetracer/mcpserver'

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