Skip to main content
Glama

list_log_groups

Retrieve all log groups within a specified Oracle Cloud Infrastructure compartment to monitor and manage logging resources.

Instructions

List all log groups in a compartment.

Args:
    compartment_id: OCID of the compartment to list log groups from

Returns:
    List of log groups with their display names and lifecycle states

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compartment_idYes

Implementation Reference

  • Core handler function that executes the OCI API call to list log groups in a compartment using pagination and formats the response.
    def list_log_groups(logging_client: oci.logging.LoggingManagementClient,
                        compartment_id: str) -> List[Dict[str, Any]]:
        """
        List all log groups in a compartment.
    
        Args:
            logging_client: OCI Logging Management client
            compartment_id: OCID of the compartment
    
        Returns:
            List of log groups with their details
        """
        try:
            log_groups_response = oci.pagination.list_call_get_all_results(
                logging_client.list_log_groups,
                compartment_id
            )
    
            log_groups = []
            for log_group in log_groups_response.data:
                log_groups.append({
                    "id": log_group.id,
                    "display_name": log_group.display_name,
                    "description": log_group.description,
                    "compartment_id": log_group.compartment_id,
                    "time_created": str(log_group.time_created),
                    "time_last_modified": str(log_group.time_last_modified),
                    "lifecycle_state": log_group.lifecycle_state,
                })
    
            logger.info(f"Found {len(log_groups)} log groups in compartment {compartment_id}")
            return log_groups
    
        except Exception as e:
            logger.exception(f"Error listing log groups: {e}")
            raise
  • MCP tool registration with @mcp.tool decorator, including wrapper for error handling, logging, and OCI client injection.
    @mcp.tool(name="list_log_groups")
    @mcp_tool_wrapper(
        start_msg="Listing log groups in compartment {compartment_id}...",
        error_prefix="Error listing log groups"
    )
    async def mcp_list_log_groups(ctx: Context, compartment_id: str) -> List[Dict[str, Any]]:
        """
        List all log groups in a compartment.
    
        Args:
            compartment_id: OCID of the compartment to list log groups from
    
        Returns:
            List of log groups with their display names and lifecycle states
        """
        return list_log_groups(oci_clients["logging"], compartment_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 states the tool lists log groups but lacks details on permissions required, pagination behavior, rate limits, or error handling. For a read operation with no annotation coverage, this is insufficient behavioral disclosure.

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 low complexity (single parameter, no output schema, no annotations), the description covers the basic purpose and parameter semantics adequately. However, it lacks details on behavioral aspects like permissions or pagination, which are important for a list operation, making it minimally complete but with gaps.

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: 'compartment_id: OCID of the compartment to list log groups from.' This clarifies the parameter's purpose and format (OCID), compensating for the 0% schema description coverage. Since there is only one parameter, the baseline is high, and the description effectively explains it.

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 log groups in a compartment.' It specifies the verb ('List') and resource ('log groups'), and the scope ('in a compartment') is explicit. However, it does not differentiate from sibling tools like 'list_logs' or 'search_logs', which prevents a score of 5.

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 mentions no prerequisites, exclusions, or comparisons to sibling tools such as 'list_logs' or 'search_logs', leaving the agent to infer usage context independently.

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