netbox_get_object_by_id
Retrieve complete details for any NetBox object by specifying its type and ID, enabling quick access to infrastructure management data.
Instructions
Get detailed information about a specific NetBox object by its ID.
Args: object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses") object_id: The numeric ID of the object
Returns: Complete object details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| object_id | Yes | ||
| object_type | Yes |
Implementation Reference
- server.py:207-228 (handler)The main handler function for the 'netbox_get_object_by_id' tool. It is decorated with @mcp.tool() for registration, validates the object_type against NETBOX_OBJECT_TYPES, constructs the API endpoint, and fetches the object details using the NetBox client.@mcp.tool() def netbox_get_object_by_id(object_type: str, object_id: int): """ Get detailed information about a specific NetBox object by its ID. Args: object_type: String representing the NetBox object type (e.g. "devices", "ip-addresses") object_id: The numeric ID of the object Returns: Complete object details """ # 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 = f"{NETBOX_OBJECT_TYPES[object_type]}/{object_id}" return netbox.get(endpoint)