Skip to main content
Glama
aliyun

Alibaba Cloud RDS OpenAPI MCP Server

Official
by aliyun

describe_error_logs

Query error logs for Alibaba Cloud RDS instances to diagnose database issues by specifying time range and instance details.

Instructions

Query error logs of an RDS instance.
Args:
    region_id: The region ID of the RDS instance.
    db_instance_id: The ID of the RDS instance.
    start_time: The start time of the query. Format: yyyy-MM-dd HH:mm.
    end_time: The end time of the query. Format: yyyy-MM-dd HH:mm.
    page_size: The number of records per page. Range: 30~100. Default: 30.
    page_number: The page number. Default: 1.
Returns:
    Dict[str, Any]: A dictionary containing error log information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
region_idYes
db_instance_idYes
start_timeYes
end_timeYes
page_sizeNo
page_numberNo

Implementation Reference

  • This is the main handler function for the 'describe_error_logs' tool. It queries error logs from Alibaba Cloud RDS using the DescribeErrorLogs API, processes the response to extract log information, and returns formatted results including logs and pagination details.
    @mcp.tool(annotations=READ_ONLY_TOOL)
    async def describe_error_logs(
            region_id: str,
            db_instance_id: str,
            start_time: str,
            end_time: str,
            page_size: int = 30,
            page_number: int = 1
    ) -> Dict[str, Any]:
        """
        Query error logs of an RDS instance.
        Args:
            region_id: The region ID of the RDS instance.
            db_instance_id: The ID of the RDS instance.
            start_time: The start time of the query. Format: yyyy-MM-dd HH:mm.
            end_time: The end time of the query. Format: yyyy-MM-dd HH:mm.
            page_size: The number of records per page. Range: 30~100. Default: 30.
            page_number: The page number. Default: 1.
        Returns:
            Dict[str, Any]: A dictionary containing error log information
        """
        try:
            start_time = transform_to_datetime(start_time)
            end_time = transform_to_datetime(end_time)
            client = get_rds_client(region_id)
            request = rds_20140815_models.DescribeErrorLogsRequest(
                dbinstance_id=db_instance_id,
                start_time=transform_to_iso_8601(start_time, "minutes"),
                end_time=transform_to_iso_8601(end_time, "minutes"),
                page_size=page_size,
                page_number=page_number
            )
            response = await client.describe_error_logs_async(request)
            return {
                "Logs": "\n".join([log.error_info for log in response.body.items.error_log]),
                "PageNumber": response.body.page_number,
                "PageRecordCount": response.body.page_record_count,
                "TotalRecordCount": response.body.total_record_count
            }
        except Exception as e:
            logger.error(f"Failed to describe error logs: {str(e)}")
            raise OpenAPIError(f"Failed to describe error logs: {str(e)}")

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/aliyun/alibabacloud-rds-openapi-mcp-server'

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