Skip to main content
Glama
scoutapp

Scout Monitoring MCP

Official

get_app_insights

Retrieve performance insights for applications to identify and resolve issues like N+1 queries, memory bloat, and slow queries, helping optimize application performance.

Instructions

Get or generate all insights for an application (cached for 5 minutes). Returns performance insights including N+1 queries, memory bloat, and slow queries. Each insight type includes count, new_count, and items array with specific details. If insight_type is provided, only that type will be returned. Args: app_id (int): The ID of the Scout APM application. insight_type: (str | None): Type of insight to filter (n_plus_one, memory_bloat, slow_query) If None (the default), all types will be returned. limit (int | None): Maximum number of items per insight type (default: 20).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
app_idYes
insight_typeNo
limitNo

Implementation Reference

  • The primary handler function for the MCP tool 'get_app_insights', including the @mcp.tool decorator for registration. It handles input parameters, calls the underlying Scout API client, and returns insights or errors.
    @mcp.tool(name="get_app_insights") async def get_app_insights( app_id: int, insight_type: str | None = None, limit: int | None = None ) -> dict[str, Any]: """ Get or generate all insights for an application (cached for 5 minutes). Returns performance insights including N+1 queries, memory bloat, and slow queries. Each insight type includes count, new_count, and items array with specific details. If insight_type is provided, only that type will be returned. Args: app_id (int): The ID of the Scout APM application. insight_type: (str | None): Type of insight to filter (n_plus_one, memory_bloat, slow_query) If None (the default), all types will be returned. limit (int | None): Maximum number of items per insight type (default: 20). """ try: async with api_client as scout_client: if insight_type is None: insights = await scout_client.get_insights(app_id, limit) else: insights = await scout_client.get_insight_by_type( app_id, insight_type, limit ) return insights except scout_api.ScoutAPMError as e: return {"error": str(e)}
  • Helper method in ScoutAPMAsync class that fetches all insights from the Scout API for a given app_id, with optional limit. Called when no specific insight_type is provided.
    async def get_insights( self, app_id: int, limit: Optional[int] = None ) -> Dict[str, Any]: """Get all insights for an application (cached for 5 minutes).""" params = {} if limit is not None: params["limit"] = limit response = await self._make_request( "GET", f"apps/{app_id}/insights", params=params if params else None ) return response.get("results", {})
  • Helper method in ScoutAPMAsync class that fetches a specific type of insight (e.g., n_plus_one, memory_bloat, slow_query) from the Scout API, with validation and optional limit. Called when insight_type is specified.
    async def get_insight_by_type( self, app_id: int, insight_type: str, limit: Optional[int] = None ) -> Dict[str, Any]: """Get data for a specific insight type. Args: app_id: Application ID insight_type: Type of insight (n_plus_one, memory_bloat, slow_query) limit: Maximum number of items (default: 20) """ if insight_type not in VALID_INSIGHTS: raise ValueError( f"Invalid insight_type. Must be one of: {', '.join(VALID_INSIGHTS)}" ) params = {} if limit is not None: params["limit"] = limit response = await self._make_request( "GET", f"apps/{app_id}/insights/{insight_type}", params=params if params else None, ) return response.get("results", {})

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/scoutapp/scout-mcp-local'

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