Skip to main content
Glama
alexkiwi1

NetBox MCP Server - Read & Write Edition

by alexkiwi1

netbox_bulk_delete_objects

Delete multiple NetBox objects simultaneously by specifying type and IDs. This tool permanently removes selected items from your infrastructure management system.

Instructions

Delete multiple objects from NetBox in a single request.

Args: object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses")
object_ids: List of numeric IDs to delete

Returns: Success status

WARNING: This permanently deletes the objects and cannot be undone!

Example: To delete multiple devices: netbox_bulk_delete_objects("devices", [5, 6, 7])

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
object_typeYes
object_idsYes

Implementation Reference

  • server.py:446-446 (registration)
    The @mcp.tool() decorator registers the netbox_bulk_delete_objects function as an MCP tool.
    @mcp.tool()
  • Core handler logic for the tool: validates input object_type using the NETBOX_OBJECT_TYPES helper, resolves endpoint, invokes netbox.bulk_delete helper method, and formats success/failure response.
    def netbox_bulk_delete_objects(object_type: str, object_ids: list):
        """
        Delete multiple objects from NetBox in a single request.
        
        Args:
            object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses")  
            object_ids: List of numeric IDs to delete
            
        Returns:
            Success status
            
        WARNING: This permanently deletes the objects and cannot be undone!
        
        Example:
        To delete multiple devices:
        netbox_bulk_delete_objects("devices", [5, 6, 7])
        """
        # Validate object_type exists in mapping
        if object_type not in NETBOX_OBJECT_TYPES:
            valid_types = "\n".join(f"- {t}" for t in sorted(NETBOX_OBJECT_TYPES.keys()))
            raise ValueError(f"Invalid object_type. Must be one of:\n{valid_types}")
            
        # Get API endpoint from mapping
        endpoint = NETBOX_OBJECT_TYPES[object_type]
            
        # Make API call
        success = netbox.bulk_delete(endpoint, object_ids)
        
        if success:
            return {"success": True, "message": f"Successfully deleted {len(object_ids)} {object_type} objects"}
        else:
            return {"success": False, "message": f"Failed to delete {object_type} objects"}
  • Function signature with type hints and comprehensive docstring define the tool's input/output schema, validation behavior, warnings, and usage example.
    def netbox_bulk_delete_objects(object_type: str, object_ids: list):
        """
        Delete multiple objects from NetBox in a single request.
        
        Args:
            object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses")  
            object_ids: List of numeric IDs to delete
            
        Returns:
            Success status
            
        WARNING: This permanently deletes the objects and cannot be undone!
        
        Example:
        To delete multiple devices:
        netbox_bulk_delete_objects("devices", [5, 6, 7])
        """
  • Essential helper mapping object_type strings to NetBox API endpoints; used for input validation (checks if object_type in keys) and endpoint resolution.
    NETBOX_OBJECT_TYPES = {
        # DCIM (Device and Infrastructure)
        "cables": "dcim/cables",
        "console-ports": "dcim/console-ports", 
        "console-server-ports": "dcim/console-server-ports",
        "devices": "dcim/devices",
        "device-bays": "dcim/device-bays",
        "device-roles": "dcim/device-roles",
        "device-types": "dcim/device-types",
        "front-ports": "dcim/front-ports",
        "interfaces": "dcim/interfaces",
        "inventory-items": "dcim/inventory-items",
        "locations": "dcim/locations",
        "manufacturers": "dcim/manufacturers",
        "modules": "dcim/modules",
        "module-bays": "dcim/module-bays",
        "module-types": "dcim/module-types",
        "platforms": "dcim/platforms",
        "power-feeds": "dcim/power-feeds",
        "power-outlets": "dcim/power-outlets",
        "power-panels": "dcim/power-panels",
        "power-ports": "dcim/power-ports",
        "racks": "dcim/racks",
        "rack-reservations": "dcim/rack-reservations",
        "rack-roles": "dcim/rack-roles",
        "regions": "dcim/regions",
        "sites": "dcim/sites",
        "site-groups": "dcim/site-groups",
        "virtual-chassis": "dcim/virtual-chassis",
        
        # IPAM (IP Address Management)
        "asns": "ipam/asns",
        "asn-ranges": "ipam/asn-ranges", 
        "aggregates": "ipam/aggregates",
        "fhrp-groups": "ipam/fhrp-groups",
        "ip-addresses": "ipam/ip-addresses",
        "ip-ranges": "ipam/ip-ranges",
        "prefixes": "ipam/prefixes",
        "rirs": "ipam/rirs",
        "roles": "ipam/roles",
        "route-targets": "ipam/route-targets",
        "services": "ipam/services",
        "vlans": "ipam/vlans",
        "vlan-groups": "ipam/vlan-groups",
        "vrfs": "ipam/vrfs",
        
        # Circuits
        "circuits": "circuits/circuits",
        "circuit-types": "circuits/circuit-types",
        "circuit-terminations": "circuits/circuit-terminations",
        "providers": "circuits/providers",
        "provider-networks": "circuits/provider-networks",
        
        # Virtualization
        "clusters": "virtualization/clusters",
        "cluster-groups": "virtualization/cluster-groups",
        "cluster-types": "virtualization/cluster-types",
        "virtual-machines": "virtualization/virtual-machines",
        "vm-interfaces": "virtualization/interfaces",
        
        # Tenancy
        "tenants": "tenancy/tenants",
        "tenant-groups": "tenancy/tenant-groups",
        "contacts": "tenancy/contacts",
        "contact-groups": "tenancy/contact-groups",
        "contact-roles": "tenancy/contact-roles",
        
        # VPN
        "ike-policies": "vpn/ike-policies",
        "ike-proposals": "vpn/ike-proposals",
        "ipsec-policies": "vpn/ipsec-policies",
        "ipsec-profiles": "vpn/ipsec-profiles",
        "ipsec-proposals": "vpn/ipsec-proposals",
        "l2vpns": "vpn/l2vpns",
        "tunnels": "vpn/tunnels",
        "tunnel-groups": "vpn/tunnel-groups",
        
        # Wireless
        "wireless-lans": "wireless/wireless-lans",
        "wireless-lan-groups": "wireless/wireless-lan-groups",
        "wireless-links": "wireless/wireless-links",
    
        # Extras
        "config-contexts": "extras/config-contexts",
        "custom-fields": "extras/custom-fields",
        "export-templates": "extras/export-templates",
        "image-attachments": "extras/image-attachments",
        "jobs": "extras/jobs",
        "saved-filters": "extras/saved-filters",
        "scripts": "extras/scripts",
        "tags": "extras/tags",
        "webhooks": "extras/webhooks",
    }
  • Core helper method implementing NetBox bulk delete via REST API DELETE /{endpoint}/bulk/ with list of {"id": id} objects; called directly by the tool handler.
    def bulk_delete(self, endpoint: str, ids: List[int]) -> bool:
        """
        Delete multiple objects from NetBox via the REST API.
        
        Args:
            endpoint: The API endpoint (e.g., 'dcim/sites', 'ipam/prefixes')
            ids: List of IDs to delete
            
        Returns:
            True if deletion was successful, False otherwise
            
        Raises:
            requests.HTTPError: If the request fails
        """
        url = f"{self._build_url(endpoint)}bulk/"
        data = [{"id": id} for id in ids]
        response = self.session.delete(url, json=data, verify=self.verify_ssl)
        response.raise_for_status()
        return response.status_code == 204
Behavior4/5

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

With no annotations provided, the description carries full burden. It discloses critical behavioral traits: the operation is permanent ('cannot be undone'), destructive (deletes objects), and operates on multiple items in a single request. It also mentions the return value ('Success status'), though briefly. It doesn't cover authentication needs, rate limits, or error handling.

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 well-structured and front-loaded with the core purpose, followed by Args, Returns, a WARNING, and an Example. Every section adds value without redundancy, making it efficient and easy to scan.

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

Completeness4/5

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

Given the tool's complexity (destructive bulk operation), no annotations, no output schema, and 0% schema coverage, the description is mostly complete. It covers purpose, parameters, returns, and critical warnings, but lacks details on error responses, permissions, or sibling tool differentiation, which would be helpful for full contextual understanding.

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?

Schema description coverage is 0%, so the description must compensate. It adds meaning for both parameters: object_type is explained as a string representing NetBox object types with examples ('devices', 'ip-addresses'), and object_ids as a list of numeric IDs to delete. The example further clarifies usage, though it doesn't detail constraints like valid object_type values or ID formats.

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

Purpose5/5

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

The description clearly states the specific action ('Delete multiple objects') and resource ('from NetBox'), distinguishing it from siblings like netbox_delete_object (singular) and netbox_bulk_create_objects. It precisely communicates the bulk deletion functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for deleting multiple objects at once, with the example showing deletion of multiple devices. However, it lacks explicit guidance on when to use this versus netbox_delete_object (for single deletions) or warnings about alternatives like netbox_bulk_update_objects for modifications instead of deletions.

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/alexkiwi1/netbox-mcp-rw'

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