Skip to main content
Glama
alexkiwi1

NetBox MCP Server - Read & Write Edition

by alexkiwi1

netbox_delete_object

Delete objects like devices or IP addresses from NetBox infrastructure management by specifying object type and ID. This action permanently removes data.

Instructions

Delete an object from NetBox.

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

Returns: True if deletion was successful

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

Example: To delete a device: netbox_delete_object("devices", 5)

To delete an IP address: netbox_delete_object("ip-addresses", 123)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
object_typeYes
object_idYes

Implementation Reference

  • The core handler function for the 'netbox_delete_object' tool. It is registered via the @mcp.tool() decorator. Validates the object_type against NETBOX_OBJECT_TYPES, maps to the API endpoint, calls netbox.delete(), and returns success status.
    @mcp.tool()
    def netbox_delete_object(object_type: str, object_id: int):
        """
        Delete an object from NetBox.
        
        Args:
            object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses")
            object_id: The numeric ID of the object to delete
            
        Returns:
            True if deletion was successful
            
        WARNING: This permanently deletes the object and cannot be undone!
        
        Example:
        To delete a device:
        netbox_delete_object("devices", 5)
        
        To delete an IP address:
        netbox_delete_object("ip-addresses", 123)
        """
        # 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 - this will raise an exception if it fails
        success = netbox.delete(endpoint, object_id)
        
        if success:
            return {"success": True, "message": f"Successfully deleted {object_type} with ID {object_id}"}
        else:
            return {"success": False, "message": f"Failed to delete {object_type} with ID {object_id}"}
  • Global dictionary mapping simple object_type names to NetBox REST API endpoints. Used by netbox_delete_object (and other CRUD tools) for validation and endpoint resolution.
    # Mapping of simple object names to API endpoints
    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",
    }
Behavior4/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 clearly states this is a destructive operation ('permanently deletes the object and cannot be undone'), which is crucial information for a deletion tool. It also specifies the return value (True if successful). However, it doesn't mention potential authentication requirements, error conditions, or rate limits.

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 well-structured with clear sections (Args, Returns, WARNING, Example) and front-loads the core purpose. Every sentence adds value, though the formatting with separate sections could be slightly more concise. The warning is appropriately emphasized for a destructive operation.

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?

For a destructive tool with no annotations and no output schema, the description does well by explaining the irreversible nature, parameters, return value, and providing examples. However, it could be more complete by mentioning authentication requirements or error handling, which are important for a deletion operation in a system like NetBox.

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

Parameters5/5

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

With 0% schema description coverage, the description fully compensates by providing detailed parameter information. It explains what object_type represents ('String representing the NetBox object type') with concrete examples ('devices', 'ip-addresses'), and clarifies object_id as 'The numeric ID of the object to delete'. The examples further illustrate proper parameter usage.

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') and resource ('an object from NetBox'), distinguishing it from siblings like netbox_create_object and netbox_update_object. It provides concrete examples showing deletion of different object types, making the purpose unambiguous.

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 provides clear context for when to use this tool (permanently deleting objects) and includes a warning about irreversibility. However, it doesn't explicitly mention when NOT to use it or name specific alternatives like netbox_bulk_delete_objects for multiple deletions, leaving some guidance implicit rather than explicit.

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