Skip to main content
Glama
alexkiwi1

NetBox MCP Server - Read & Write Edition

by alexkiwi1

netbox_bulk_create_objects

Create multiple NetBox objects in one request to streamline infrastructure management. Specify object type and data list for bulk creation.

Instructions

Create multiple objects in NetBox in a single request.

Args: object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses") data: List of dicts containing the object data to create

Returns: List of created objects

Example: To create multiple sites: netbox_bulk_create_objects("sites", [ {"name": "Site A", "slug": "site-a", "status": "active"}, {"name": "Site B", "slug": "site-b", "status": "active"} ])

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
object_typeYes
dataYes

Implementation Reference

  • MCP tool handler for netbox_bulk_create_objects: validates object_type against NETBOX_OBJECT_TYPES mapping, resolves the API endpoint, and delegates to NetBoxRestClient.bulk_create for the actual bulk creation via NetBox REST API.
    @mcp.tool()
    def netbox_bulk_create_objects(object_type: str, data: list):
        """
        Create multiple objects in NetBox in a single request.
        
        Args:
            object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses")
            data: List of dicts containing the object data to create
            
        Returns:
            List of created objects
            
        Example:
        To create multiple sites:
        netbox_bulk_create_objects("sites", [
            {"name": "Site A", "slug": "site-a", "status": "active"},
            {"name": "Site B", "slug": "site-b", "status": "active"}
        ])
        """
        # 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
        return netbox.bulk_create(endpoint, data)
  • NETBOX_OBJECT_TYPES dictionary mapping tool-friendly object_type strings to NetBox REST API endpoints. Used by the handler to resolve the correct endpoint for bulk creation.
    # 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",
    }
  • NetBoxRestClient.bulk_create method: performs HTTP POST to the NetBox bulk endpoint (endpoint/bulk/) with the list of data objects, handles response and returns list of created objects.
    def bulk_create(self, endpoint: str, data: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
        """
        Create multiple objects in NetBox via the REST API.
        
        Args:
            endpoint: The API endpoint (e.g., 'dcim/sites', 'ipam/prefixes')
            data: List of object data to create
            
        Returns:
            List of created objects as dicts
            
        Raises:
            requests.HTTPError: If the request fails
        """
        url = f"{self._build_url(endpoint)}bulk/"
        response = self.session.post(url, json=data, verify=self.verify_ssl)
        response.raise_for_status()
        return response.json()
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states it's a creation operation but doesn't disclose behavioral traits like required permissions, rate limits, error handling for partial failures, or whether it's transactional. The example adds some context but lacks comprehensive behavioral details needed for a mutation tool with zero annotation coverage.

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 appropriately sized and front-loaded: the first sentence states the purpose clearly, followed by structured sections for Args, Returns, and an Example. Every sentence earns its place without redundancy, making it efficient and easy to parse.

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?

Given the tool's complexity (bulk creation with 2 parameters), no annotations, and no output schema, the description is moderately complete. It covers purpose and parameters well but lacks details on behavioral aspects like permissions or error handling, which are important for a mutation tool. The example helps but doesn't fully compensate for the missing context.

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?

With 0% schema description coverage, the description compensates well by explaining both parameters: 'object_type' as a string representing NetBox object type with examples, and 'data' as a list of dicts containing object data. It provides an example that clarifies usage, adding significant meaning beyond the bare schema.

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 tool creates multiple objects in NetBox in a single request, specifying the verb ('create multiple objects') and resource ('in NetBox'). It distinguishes from the singular 'netbox_create_object' sibling by emphasizing bulk operations, though it doesn't explicitly differentiate from other bulk siblings like 'netbox_bulk_update_objects'.

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

Usage Guidelines3/5

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

The description implies usage for creating multiple objects at once, suggesting when to use it over the singular create tool. However, it doesn't provide explicit guidance on when to choose this over other bulk tools (e.g., 'netbox_bulk_update_objects') or mention any prerequisites or exclusions, leaving some context to inference.

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