Skip to main content
Glama
aiopnet

MCP Nautobot Server

by aiopnet

get_ip_address_by_id

Retrieve a specific IP address from Nautobot using its unique ID to access network infrastructure data for automation and management tasks.

Instructions

Retrieve a specific IP address by its Nautobot ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ip_idYesThe Nautobot ID of the IP address

Implementation Reference

  • The MCP tool handler in handle_call_tool that extracts the ip_id argument, calls the NautobotClient's get_ip_address_by_id method, handles not found cases, and returns a formatted text response with JSON data.
    elif name == "get_ip_address_by_id":
        ip_id = args.get("ip_id")
        if not ip_id:
            raise ValueError("ip_id is required")
        
        logger.info(f"Retrieving IP address by ID: {ip_id}")
        
        # Get specific IP address
        ip_address = await client.get_ip_address_by_id(ip_id)
        
        if ip_address is None:
            return [
                types.TextContent(
                    type="text",
                    text=f"IP address with ID '{ip_id}' not found in Nautobot."
                )
            ]
        
        result = ip_address.model_dump()
        
        return [
            types.TextContent(
                type="text",
                text=f"Retrieved IP address from Nautobot:\n\n"
                     f"```json\n{result}\n```"
            )
        ]
  • Registration of the 'get_ip_address_by_id' tool in list_tools, including name, description, and input schema requiring 'ip_id'.
    types.Tool(
        name="get_ip_address_by_id",
        description="Retrieve a specific IP address by its Nautobot ID",
        inputSchema={
            "type": "object",
            "properties": {
                "ip_id": {
                    "type": "string",
                    "description": "The Nautobot ID of the IP address"
                }
            },
            "required": ["ip_id"],
            "additionalProperties": False
        },
    ),
  • Pydantic model defining the structure of IPAddress data returned by the tool.
    class IPAddress(BaseModel):
        """Pydantic model for Nautobot IP address data."""
        
        id: str
        url: HttpUrl
        address: str
        status: Dict[str, Any]
        role: Optional[Dict[str, Any]] = None
        tenant: Optional[Dict[str, Any]] = None
        vrf: Optional[Dict[str, Any]] = None
        nat_inside: Optional[Dict[str, Any]] = None
        nat_outside: Optional[Dict[str, Any]] = None
        dns_name: Optional[str] = None
        description: Optional[str] = None
        comments: Optional[str] = None
        tags: List[Dict[str, Any]] = Field(default_factory=list)
        custom_fields: Dict[str, Any] = Field(default_factory=dict)
        created: str
        last_updated: str
  • Core helper method in NautobotClient that performs the API GET request to retrieve IP address by ID, parses to IPAddress model, and returns None on 404.
    async def get_ip_address_by_id(self, ip_id: str) -> Optional[IPAddress]:
        """
        Retrieve a specific IP address by its ID.
        
        Args:
            ip_id: The IP address ID
            
        Returns:
            IPAddress object or None if not found
            
        Raises:
            NautobotError: For API or connection errors
        """
        try:
            response = await self._make_request("GET", f"/ipam/ip-addresses/{ip_id}/")
            return IPAddress(**response)
        except NautobotAPIError as e:
            if e.status_code == 404:
                return None
            raise
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the tool retrieves data, implying a read-only operation, but doesn't disclose behavioral traits such as authentication needs, rate limits, error handling (e.g., what happens if the ID doesn't exist), or response format. The description is minimal and lacks context beyond the basic action.

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

Conciseness5/5

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

The description is a single, clear sentence with no wasted words. It front-loads the key information ('Retrieve a specific IP address') and efficiently specifies the method ('by its Nautobot ID'). Every part of the sentence earns its place.

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 tool's low complexity (single parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on behavior, usage context, or output, leaving gaps that could hinder an AI agent. Without annotations or output schema, more completeness would be beneficial for a retrieval tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the single parameter 'ip_id' documented as 'The Nautobot ID of the IP address'. The description adds no additional meaning beyond this, such as format examples or constraints. Baseline score of 3 is appropriate since the schema adequately covers the parameter.

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 action ('Retrieve') and resource ('a specific IP address'), and specifies the lookup method ('by its Nautobot ID'). It distinguishes from siblings like 'get_ip_addresses' (plural) by indicating retrieval of a single specific record. However, it doesn't explicitly contrast with 'search_ip_addresses' which might also retrieve IP addresses through different criteria.

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 when you have the Nautobot ID and want to fetch a single IP address, but it doesn't explicitly state when to use this versus alternatives like 'search_ip_addresses' or 'get_ip_addresses'. No guidance on prerequisites, error conditions, or exclusions 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/aiopnet/mcp-nautobot'

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