netbox_get_object_by_id
Retrieve detailed information about specific network infrastructure objects in NetBox using their unique ID and type, such as devices, IP addresses, or sites.
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 core handler function for the 'netbox_get_object_by_id' MCP tool. It is registered via the @mcp.tool() decorator, validates the object_type against supported NetBox types, constructs the REST API endpoint, and fetches the specific object by ID 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)
- netbox_llm_chatbot.py:71-90 (schema)The JSON schema defining the input parameters and structure for the 'netbox_get_object_by_id' tool, used by the LLM chatbot to invoke the tool correctly with object_type (string) and object_id (integer)."type": "function", "function": { "name": "netbox_get_object_by_id", "description": "Get detailed information about a specific NetBox object by its ID.", "parameters": { "type": "object", "properties": { "object_type": { "type": "string", "description": "Type of NetBox object" }, "object_id": { "type": "integer", "description": "The numeric ID of the object" } }, "required": ["object_type", "object_id"] } } },