Skip to main content
Glama

list_security_lists

Retrieve security lists from an Oracle Cloud Infrastructure compartment, with optional filtering by Virtual Cloud Network to view ingress and egress rules.

Instructions

List all security lists in a compartment, optionally filtered by VCN.

Args:
    compartment_id: OCID of the compartment to list security lists from
    vcn_id: Optional OCID of the VCN to filter security lists

Returns:
    List of security lists with their ingress and egress rules

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compartment_idYes
vcn_idNo

Implementation Reference

  • Core handler function implementing the logic to list OCI security lists in a compartment using the OCI VirtualNetworkClient, including pagination, error handling, and formatting the response with key details like rule counts.
    def list_security_lists(network_client: oci.core.VirtualNetworkClient, compartment_id: str, 
                            vcn_id: Optional[str] = None) -> List[Dict[str, Any]]:
        """
        List all security lists in a compartment, optionally filtered by VCN.
        
        Args:
            network_client: OCI VirtualNetwork client
            compartment_id: OCID of the compartment
            vcn_id: Optional OCID of the VCN to filter by
            
        Returns:
            List of security lists with their details
        """
        try:
            security_lists_response = oci.pagination.list_call_get_all_results(
                network_client.list_security_lists,
                compartment_id,
                vcn_id=vcn_id
            )
            
            security_lists = []
            for security_list in security_lists_response.data:
                security_lists.append({
                    "id": security_list.id,
                    "display_name": security_list.display_name,
                    "compartment_id": security_list.compartment_id,
                    "vcn_id": security_list.vcn_id,
                    "lifecycle_state": security_list.lifecycle_state,
                    "time_created": str(security_list.time_created),
                    "ingress_security_rules_count": len(security_list.ingress_security_rules) if security_list.ingress_security_rules else 0,
                    "egress_security_rules_count": len(security_list.egress_security_rules) if security_list.egress_security_rules else 0,
                })
            
            logger.info(f"Found {len(security_lists)} security lists in compartment {compartment_id}")
            return security_lists
            
        except Exception as e:
            logger.exception(f"Error listing security lists: {e}")
            raise
  • MCP tool registration for 'list_security_lists' using @mcp.tool decorator, wraps the security.py handler with common error handling via mcp_tool_wrapper, and passes OCI network client and parameters to the handler.
    @mcp.tool(name="list_security_lists")
    @mcp_tool_wrapper(
        start_msg="Listing security lists in compartment {compartment_id}...",
        error_prefix="Error listing security lists"
    )
    async def mcp_list_security_lists(ctx: Context, compartment_id: str, vcn_id: Optional[str] = None) -> List[Dict[str, Any]]:
        """
        List all security lists in a compartment, optionally filtered by VCN.
    
        Args:
            compartment_id: OCID of the compartment to list security lists from
            vcn_id: Optional OCID of the VCN to filter security lists
    
        Returns:
            List of security lists with their ingress and egress rules
        """
        return list_security_lists(oci_clients["network"], compartment_id, vcn_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. It mentions the tool lists security lists with their rules, but does not disclose behavioral traits such as pagination, rate limits, permissions required, or error handling. This is a significant gap for a tool with no annotation coverage.

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 well-structured and front-loaded with the core purpose, followed by clear sections for Args and Returns. Every sentence adds value without redundancy, making it 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 moderate complexity (2 parameters, no output schema, no annotations), the description is partially complete. It covers the purpose and parameters well but lacks behavioral details and usage guidelines. Without an output schema, it helpfully mentions the return includes 'ingress and egress rules', but more context on behavior is needed.

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 both parameters: 'compartment_id' is described as 'OCID of the compartment to list security lists from', and 'vcn_id' as 'Optional OCID of the VCN to filter security lists'. This clarifies their roles beyond the schema's basic titles, compensating for the 0% schema description coverage.

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: 'List all security lists in a compartment, optionally filtered by VCN.' It specifies the verb ('List'), resource ('security lists'), and scope ('compartment'), but does not explicitly differentiate it from sibling tools like 'get_security_list' or 'list_network_security_groups'.

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?

No guidance is provided on when to use this tool versus alternatives. The description mentions optional VCN filtering but does not specify when to use this tool over 'get_security_list' (singular) or other list tools, nor does it mention prerequisites or exclusions.

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