Skip to main content
Glama
alexkiwi1

NetBox MCP Server - Read & Write Edition

by alexkiwi1

netbox_create_object

Create new objects in NetBox infrastructure management, including devices, IP addresses, sites, and racks. Specify object type and data to add network resources to your inventory.

Instructions

Create a new object in NetBox.

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

Returns: The created object as a dict

Example: To create a new site: netbox_create_object("sites", { "name": "New Site", "slug": "new-site", "status": "active" })

To create a new device: netbox_create_object("devices", { "name": "new-device", "device_type": 1, # ID of device type "site": 1, # ID of site "role": 1, # ID of device role "status": "active" })

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
object_typeYes
dataYes

Implementation Reference

  • The handler function for the 'netbox_create_object' tool. Decorated with @mcp.tool() for registration. Validates object_type using NETBOX_OBJECT_TYPES mapping, resolves the API endpoint, and creates the object via netbox.create().
    @mcp.tool()
    def netbox_create_object(object_type: str, data: dict):
        """
        Create a new object in NetBox.
        
        Args:
            object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses")
            data: Dict containing the object data to create
            
        Returns:
            The created object as a dict
            
        Example:
        To create a new site:
        netbox_create_object("sites", {
            "name": "New Site",
            "slug": "new-site", 
            "status": "active"
        })
        
        To create a new device:
        netbox_create_object("devices", {
            "name": "new-device",
            "device_type": 1,  # ID of device type
            "site": 1,         # ID of site
            "role": 1,         # ID of device role
            "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.create(endpoint, data)
  • Global NETBOX_OBJECT_TYPES mapping used by netbox_create_object (and other tools) to validate object_type and resolve the corresponding NetBox REST API endpoint.
    # 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",
    }
  • Function signature and docstring defining the input schema (object_type: str, data: dict), output (created object dict), validation logic reference, and usage examples for the tool.
    def netbox_create_object(object_type: str, data: dict):
        """
        Create a new object in NetBox.
        
        Args:
            object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses")
            data: Dict containing the object data to create
            
        Returns:
            The created object as a dict
            
        Example:
        To create a new site:
        netbox_create_object("sites", {
            "name": "New Site",
            "slug": "new-site", 
            "status": "active"
        })
        
        To create a new device:
        netbox_create_object("devices", {
            "name": "new-device",
            "device_type": 1,  # ID of device type
            "site": 1,         # ID of site
            "role": 1,         # ID of device role
            "status": "active"
        })
        """
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 this is a creation operation but doesn't mention authentication requirements, rate limits, error conditions, or what happens on duplicate data. The examples show successful creation but don't describe failure modes or behavioral traits beyond the basic 'creates and returns' pattern.

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 (purpose, args, returns, examples) and front-loaded information. The examples are helpful but slightly lengthy. Most sentences earn their place, though some example details could potentially be condensed while maintaining clarity.

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 creation tool with 2 parameters, no annotations, and no output schema, the description provides adequate basics but lacks completeness. It explains parameters well and shows examples, but doesn't cover authentication, error handling, or return format details beyond 'dict'. Given the mutation nature and sibling tools, more context about when this tool fails or succeeds would be beneficial.

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 must compensate, which it does effectively. It explains that 'object_type' is a string representing NetBox object types (e.g., 'devices', 'ip-addresses') and 'data' is a dict containing object data. The examples provide concrete syntax and format, adding significant value 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 verb ('Create') and resource ('new object in NetBox'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this single-object creation tool from its sibling 'netbox_bulk_create_objects', which handles multiple objects. The examples help clarify but don't provide explicit sibling differentiation.

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 through examples (creating sites and devices) but doesn't explicitly state when to use this tool versus alternatives like 'netbox_bulk_create_objects' for multiple objects or 'netbox_update_object' for modifications. The context is clear (creating single objects), but no explicit guidance on exclusions or alternatives is provided.

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