Skip to main content
Glama

get_ai_config

Retrieve AI provider configuration settings used for root cause analysis via the MCP Server for Coroot, enabling precise monitoring and performance insights.

Instructions

Get AI provider configuration.

Retrieves AI provider settings used for root cause analysis.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool registration for 'get_ai_config' using @mcp.tool() decorator. This registers the tool with FastMCP framework.
    @mcp.tool() async def get_ai_config() -> dict[str, Any]: """Get AI provider configuration. Retrieves AI provider settings used for root cause analysis. """ return await get_ai_config_impl() # type: ignore[no-any-return]
  • Handler implementation that obtains CorootClient, calls client.get_ai_config(), and wraps response with success flag.
    async def get_ai_config_impl() -> dict[str, Any]: """Get AI configuration.""" client = get_client() config = await client.get_ai_config() return { "success": True, "config": config, }
  • Core handler in CorootClient that performs HTTP GET request to Coroot API endpoint /api/ai and returns the JSON response.
    async def get_ai_config(self) -> dict[str, Any]: """Get AI provider configuration. Returns: AI provider configuration. """ response = await self._request("GET", "/api/ai") data: dict[str, Any] = response.json() return data
  • Helper function that lazily initializes and returns the shared CorootClient instance used by all tools.
    def get_client() -> CorootClient: """Get or create the client instance. Raises: ValueError: If no credentials are configured. """ global _client if _client is None: try: _client = CorootClient() except ValueError as e: # Re-raise with more context raise ValueError( "Coroot credentials not configured. " "Please set COROOT_BASE_URL and either:\n" " - COROOT_USERNAME and COROOT_PASSWORD for automatic login\n" " - COROOT_SESSION_COOKIE for direct authentication\n" " - COROOT_API_KEY for data ingestion endpoints" ) from e return _client
  • Error handling decorator applied to tool implementations to standardize error responses.
    def handle_errors(func: Callable[..., Any]) -> Callable[..., Any]: """Decorator to handle common errors in tool implementations.""" @wraps(func) async def wrapper(*args: Any, **kwargs: Any) -> dict[str, Any]: try: return await func(*args, **kwargs) # type: ignore[no-any-return] except ValueError as e: # Handle missing credentials or other validation errors return { "success": False, "error": str(e), "error_type": "validation", } except CorootError as e: # Handle Coroot API errors (including authentication) error_msg = str(e) if "Authentication failed" in error_msg: return { "success": False, "error": error_msg, "error_type": "authentication", } elif "401" in error_msg or "Unauthorized" in error_msg: return { "success": False, "error": "Authentication required. Please check your credentials.", "error_type": "authentication", } return { "success": False, "error": error_msg, "error_type": "api_error", } except Exception as e: # Handle unexpected errors return { "success": False, "error": f"Unexpected error: {str(e)}", "error_type": "unknown", } 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/jamesbrink/mcp-coroot'

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