Skip to main content
Glama
jseifeddine

NetBox MCP Server

by jseifeddine

netbox_get_objects

Retrieve network infrastructure data from NetBox by specifying object types and applying filters to query devices, IP addresses, sites, and other network components.

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 primary handler function for the 'netbox_get_objects' MCP tool. It validates the object_type against the predefined mapping, constructs the NetBox API endpoint, and retrieves objects using the provided filters.
    @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)
  • Dictionary mapping friendly object_type names to NetBox REST API endpoints, used for validation and endpoint resolution in the handler.
    # 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",
    }
  • JSON schema definition for the netbox_get_objects tool used by the LLM client for tool calling.
    {
        "type": "function",
        "function": {
            "name": "netbox_get_objects",
            "description": "Get objects from NetBox based on their type and filters. Use this to retrieve devices, sites, IP addresses, VLANs, etc.",
            "parameters": {
                "type": "object",
                "properties": {
                    "object_type": {
                        "type": "string",
                        "description": "Type of NetBox object (e.g., 'devices', 'ip-addresses', 'sites', 'vlans', 'interfaces', 'racks', 'device-types', 'manufacturers', 'tenants', 'circuits', 'virtual-machines', 'prefixes', 'services')"
                    },
                    "filters": {
                        "type": "object",
                        "description": "Filters to apply to the API call. Common filters include 'site', 'status', 'limit', 'name', etc."
                    }
                },
                "required": ["object_type"]
            }
        }
  • server.py:103-103 (registration)
    FastMCP decorator that registers the netbox_get_objects function as an MCP tool.
    @mcp.tool()
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 mentions that filters are based on NetBox API filtering options and lists object types, but it doesn't disclose behavioral traits like whether this is a read-only operation, potential rate limits, authentication needs, error handling, or pagination. The description is functional but lacks critical operational context for a tool with no annotations.

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, but it includes a lengthy, bulleted list of object_type values that could be considered excessive. While this list adds value, it makes the description less concise. The structure is clear with sections for args and valid values, but it could be more streamlined for readability.

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 complexity (2 parameters, no annotations, no output schema, nested objects in filters), the description is partially complete. It covers parameter semantics well but lacks behavioral transparency and output details. Without annotations or an output schema, it should ideally explain more about the tool's behavior and return values to be fully adequate for agent use.

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. It defines object_type as a string representing NetBox object types and provides an extensive list of valid values. It describes filters as a dict based on NetBox API filtering options, adding meaningful context beyond the bare schema. However, it doesn't detail the structure or examples of filter dicts.

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'), distinguishing it from siblings like netbox_get_object_by_id (which fetches a single object by ID) and netbox_get_changelogs (which retrieves change logs). However, it doesn't explicitly differentiate from netbox_get_changelogs beyond the resource type.

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 by listing valid object_type values and referencing the NetBox API for filtering, but it doesn't explicitly state when to use this tool versus alternatives. For example, it doesn't clarify that netbox_get_object_by_id is for retrieving a single object by ID, while this tool is for filtered queries. The guidance is present but not explicit about alternatives.

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/jseifeddine/netbox-mcp-chatbot'

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