Skip to main content
Glama
awslabs

Log Analyzer with MCP

Official
by awslabs
__init__.py991 B
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import functools import json import traceback from typing import Callable def handle_exceptions(func: Callable) -> Callable: """ Decorator for handling exceptions in tool methods. Ensures that all tool methods return a standardized error response rather than raising exceptions that would cause the client to fail. """ @functools.wraps(func) async def wrapper(*args, **kwargs): try: return await func(*args, **kwargs) except Exception as e: error_traceback = traceback.format_exc() error_response = { "status": "Error", "error": str(e), "error_type": e.__class__.__name__, "details": error_traceback.split("\n")[-2] if error_traceback else None, } return json.dumps(error_response, indent=2) return wrapper

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/awslabs/Log-Analyzer-with-MCP'

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