Skip to main content
Glama
alexkiwi1

NetBox MCP Server - Read & Write Edition

by alexkiwi1

netbox_get_objects

Retrieve NetBox infrastructure objects like devices, IP addresses, or sites using type-specific filters to query the API.

Instructions

Get objects from NetBox based on their type and filters Args: object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses") filters: dict of filters to apply to the API call based on the NetBox API filtering options

Valid object_type values:

DCIM (Device and Infrastructure):

  • cables

  • console-ports

  • console-server-ports

  • devices

  • device-bays

  • device-roles

  • device-types

  • front-ports

  • interfaces

  • inventory-items

  • locations

  • manufacturers

  • modules

  • module-bays

  • module-types

  • platforms

  • power-feeds

  • power-outlets

  • power-panels

  • power-ports

  • racks

  • rack-reservations

  • rack-roles

  • regions

  • sites

  • site-groups

  • virtual-chassis

IPAM (IP Address Management):

  • asns

  • asn-ranges

  • aggregates

  • fhrp-groups

  • ip-addresses

  • ip-ranges

  • prefixes

  • rirs

  • roles

  • route-targets

  • services

  • vlans

  • vlan-groups

  • vrfs

Circuits:

  • circuits

  • circuit-types

  • circuit-terminations

  • providers

  • provider-networks

Virtualization:

  • clusters

  • cluster-groups

  • cluster-types

  • virtual-machines

  • vm-interfaces

Tenancy:

  • tenants

  • tenant-groups

  • contacts

  • contact-groups

  • contact-roles

VPN:

  • ike-policies

  • ike-proposals

  • ipsec-policies

  • ipsec-profiles

  • ipsec-proposals

  • l2vpns

  • tunnels

  • tunnel-groups

Wireless:

  • wireless-lans

  • wireless-lan-groups

  • wireless-links

See NetBox API documentation for filtering options for each object type.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
object_typeYes
filtersYes

Implementation Reference

  • The core handler function for the 'netbox_get_objects' tool. Decorated with @mcp.tool() for automatic registration in the MCP server. Validates the object_type against the NETBOX_OBJECT_TYPES mapping, resolves the API endpoint, and retrieves objects from NetBox using the provided filters via the netbox client.
    @mcp.tool()
    def netbox_get_objects(object_type: str, filters: dict):
        """
        Get objects from NetBox based on their type and filters
        Args:
            object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses")
            filters: dict of filters to apply to the API call based on the NetBox API filtering options
        
        Valid object_type values:
        
        DCIM (Device and Infrastructure):
        - cables
        - console-ports
        - console-server-ports  
        - devices
        - device-bays
        - device-roles
        - device-types
        - front-ports
        - interfaces
        - inventory-items
        - locations
        - manufacturers
        - modules
        - module-bays
        - module-types
        - platforms
        - power-feeds
        - power-outlets
        - power-panels
        - power-ports
        - racks
        - rack-reservations
        - rack-roles
        - regions
        - sites
        - site-groups
        - virtual-chassis
        
        IPAM (IP Address Management):
        - asns
        - asn-ranges
        - aggregates 
        - fhrp-groups
        - ip-addresses
        - ip-ranges
        - prefixes
        - rirs
        - roles
        - route-targets
        - services
        - vlans
        - vlan-groups
        - vrfs
        
        Circuits:
        - circuits
        - circuit-types
        - circuit-terminations
        - providers
        - provider-networks
        
        Virtualization:
        - clusters
        - cluster-groups
        - cluster-types
        - virtual-machines
        - vm-interfaces
        
        Tenancy:
        - tenants
        - tenant-groups
        - contacts
        - contact-groups
        - contact-roles
        
        VPN:
        - ike-policies
        - ike-proposals
        - ipsec-policies
        - ipsec-profiles
        - ipsec-proposals
        - l2vpns
        - tunnels
        - tunnel-groups
        
        Wireless:
        - wireless-lans
        - wireless-lan-groups
        - wireless-links
        
        See NetBox API documentation for filtering options for each object type.
        """
        # 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.get(endpoint, params=filters)
  • Constant mapping of supported NetBox object type names (e.g., 'devices') to their corresponding REST API endpoints. Used by netbox_get_objects for validation of object_type parameter and endpoint construction.
    # 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",
    }
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 mentions filtering based on NetBox API options, hinting at read-only behavior, but doesn't explicitly state whether this is a safe read operation, its pagination or rate limits, error handling, or output format. For a tool with two parameters and no annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose and args, but the lengthy list of object types (over 60 items) dominates the text, making it verbose. While the list is informative, it could be summarized or referenced externally to improve conciseness. The structure is logical but not optimally sized for quick scanning.

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 2 parameters, no annotations, no output schema, and 0% schema coverage, the description does well by detailing parameter semantics and object types. However, it lacks information on behavioral aspects (e.g., read-only nature, pagination) and output format, which are critical for a retrieval tool. It's partially complete but misses key contextual elements for full agent 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 provides extensive context: 'object_type' is explained with a string example and a comprehensive list of valid values across categories (DCIM, IPAM, etc.), and 'filters' is described as a dict for API filtering with a reference to NetBox documentation. This adds substantial meaning beyond the bare schema, though it doesn't detail filter syntax or examples.

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's purpose: 'Get objects from NetBox based on their type and filters.' It specifies the verb ('Get') and resource ('objects from NetBox'), and distinguishes it from siblings like 'netbox_get_object_by_id' by implying bulk retrieval with filters. However, it doesn't explicitly differentiate from other read operations like 'netbox_get_changelogs' beyond the object focus.

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 retrieving multiple objects with filtering, as opposed to 'netbox_get_object_by_id' for single objects by ID. It lists valid object types, suggesting when to use it for specific data categories. However, it lacks explicit guidance on when not to use it (e.g., vs. bulk operations or changelogs) or clear alternatives beyond the implied sibling distinction.

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