Skip to main content
Glama

get_network_security_group

Retrieve detailed configuration and security rules for a specific Network Security Group in Oracle Cloud Infrastructure to manage network access controls.

Instructions

Get detailed information about a specific Network Security Group.

Args:
    nsg_id: OCID of the NSG to retrieve

Returns:
    Detailed NSG information with all security rules

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nsg_idYes

Implementation Reference

  • Handler function that fetches and formats details of a specific Network Security Group (NSG) using the OCI VirtualNetworkClient. Returns a dictionary with id, display_name, compartment_id, vcn_id, lifecycle_state, and time_created.
    def get_network_security_group(network_client: oci.core.VirtualNetworkClient, nsg_id: str) -> Dict[str, Any]:
        """
        Get details of a specific network security group.
        
        Args:
            network_client: OCI VirtualNetwork client
            nsg_id: OCID of the network security group
            
        Returns:
            Details of the network security group
        """
        try:
            nsg = network_client.get_network_security_group(nsg_id).data
            
            nsg_details = {
                "id": nsg.id,
                "display_name": nsg.display_name,
                "compartment_id": nsg.compartment_id,
                "vcn_id": nsg.vcn_id,
                "lifecycle_state": nsg.lifecycle_state,
                "time_created": str(nsg.time_created),
            }
            
            logger.info(f"Retrieved details for network security group {nsg_id}")
            return nsg_details
            
        except Exception as e:
            logger.exception(f"Error getting network security group details: {e}")
            raise
  • MCP tool registration for 'get_network_security_group'. Wraps the handler with logging, error handling via mcp_tool_wrapper, and calls the handler with the network client from oci_clients.
    @mcp.tool(name="get_network_security_group")
    @mcp_tool_wrapper(
        start_msg="Getting network security group details for {nsg_id}...",
        success_msg="Retrieved network security group details successfully",
        error_prefix="Error getting network security group details"
    )
    async def mcp_get_network_security_group(ctx: Context, nsg_id: str) -> Dict[str, Any]:
        """
        Get detailed information about a specific Network Security Group.
    
        Args:
            nsg_id: OCID of the NSG to retrieve
    
        Returns:
            Detailed NSG information with all security rules
        """
        return get_network_security_group(oci_clients["network"], nsg_id)
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 of behavioral disclosure. It states the tool retrieves 'detailed information' and 'all security rules,' which hints at a read-only operation, but it doesn't explicitly confirm safety (e.g., no destructive effects), mention authentication needs, rate limits, or error conditions. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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

Conciseness4/5

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

The description is well-structured and concise, using a clear purpose statement followed by 'Args' and 'Returns' sections. Each sentence adds value without redundancy. It could be slightly more front-loaded by integrating the parameter info into the main description, but overall, it's efficient and easy to parse.

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 (one parameter, no nested objects) and lack of annotations or output schema, the description is moderately complete. It covers the purpose and parameter semantics adequately but lacks behavioral details (e.g., safety, auth) and doesn't fully explain the return value beyond 'Detailed NSG information with all security rules.' For a read operation, this is minimal but viable.

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?

The description adds meaningful context for the single parameter: 'nsg_id: OCID of the NSG to retrieve.' This clarifies that 'nsg_id' is an Oracle Cloud Identifier (OCID), which is crucial semantic information not present in the input schema (which has 0% description coverage). Since there's only one parameter, this effectively compensates for the schema's lack of detail.

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 detailed information about a specific Network Security Group.' It uses a specific verb ('Get') and resource ('Network Security Group'), making the intent unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'list_network_security_groups' or 'get_security_list', which would be needed for a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'list_network_security_groups' for listing multiple NSGs or 'get_security_list' for related resources, nor does it specify prerequisites or contexts for usage. The absence of such guidance leaves the agent to infer usage from the tool name alone.

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/jopsis/mcp-server-oci'

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