Skip to main content
Glama

list_logs

Retrieve logs from Oracle Cloud Infrastructure log groups to monitor activity, analyze retention settings, and manage log data for troubleshooting and compliance.

Instructions

List all logs in a log group.

Args:
    log_group_id: OCID of the log group

Returns:
    List of logs with their types, retention, and enabled state

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
log_group_idYes

Implementation Reference

  • Core implementation of the list_logs tool handler. Fetches all logs in a specified log group using OCI pagination and returns formatted log details.
    def list_logs(logging_client: oci.logging.LoggingManagementClient,
                  log_group_id: str) -> List[Dict[str, Any]]:
        """
        List all logs in a log group.
    
        Args:
            logging_client: OCI Logging Management client
            log_group_id: OCID of the log group
    
        Returns:
            List of logs with their details
        """
        try:
            logs_response = oci.pagination.list_call_get_all_results(
                logging_client.list_logs,
                log_group_id
            )
    
            logs = []
            for log in logs_response.data:
                logs.append({
                    "id": log.id,
                    "log_group_id": log.log_group_id,
                    "display_name": log.display_name,
                    "log_type": log.log_type,
                    "lifecycle_state": log.lifecycle_state,
                    "is_enabled": log.is_enabled,
                    "retention_duration": log.retention_duration,
                    "compartment_id": log.compartment_id,
                    "time_created": str(log.time_created),
                    "time_last_modified": str(log.time_last_modified),
                })
    
            logger.info(f"Found {len(logs)} logs in log group {log_group_id}")
            return logs
    
        except Exception as e:
            logger.exception(f"Error listing logs: {e}")
            raise
  • MCP tool registration for 'list_logs'. Decorates the wrapper handler with @mcp.tool(name="list_logs"), adds logging/error handling, and delegates to the core list_logs implementation.
    @mcp.tool(name="list_logs")
    @mcp_tool_wrapper(
        start_msg="Listing logs in log group {log_group_id}...",
        error_prefix="Error listing logs"
    )
    async def mcp_list_logs(ctx: Context, log_group_id: str) -> List[Dict[str, Any]]:
        """
        List all logs in a log group.
    
        Args:
            log_group_id: OCID of the log group
    
        Returns:
            List of logs with their types, retention, and enabled state
        """
        return list_logs(oci_clients["logging"], log_group_id)
  • Import statement that brings the list_logs helper function from monitoring.py into the MCP server for tool registration.
    from mcp_server_oci.tools.monitoring import (
        list_alarms,
        get_alarm,
        get_alarm_history,
        list_metrics,
        query_metric_data,
        search_logs,
        list_log_groups,
        list_logs,
    )
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states this is a list operation but doesn't mention whether it's read-only, requires authentication, has rate limits, returns paginated results, or what happens on errors. 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.

Conciseness5/5

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

The description is perfectly structured and concise: a clear purpose statement followed by well-organized Args and Returns sections. Every sentence earns its place with no wasted words, making it easy to parse and understand quickly.

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 adequate but incomplete. It covers the basic purpose and parameter but lacks behavioral context, usage guidance, and output details beyond a high-level summary. This meets minimum viability but has clear 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 explicitly documents the single parameter ('log_group_id: OCID of the log group'), adding crucial semantic meaning beyond the schema's 0% coverage. While it doesn't explain the OCID format or provide examples, it compensates well for the schema's lack of descriptions, earning a strong score.

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 verb ('List') and resource ('logs in a log group'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'search_logs' or 'list_log_groups', which would require explicit comparison to achieve 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 like 'search_logs' or 'list_log_groups'. It mentions the required parameter but offers no context about prerequisites, permissions, or typical use cases, leaving the agent to infer usage scenarios.

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