Skip to main content
Glama
scoutapp

Scout Monitoring MCP

Official

get_app_endpoint_traces

Retrieve recent performance traces for a specific application endpoint within a defined time range to analyze and troubleshoot performance issues.

Instructions

Get recent traces for an app filtered to a specific endpoint.

Args:
    app_id (int): The ID of the Scout APM application.
    endpoint_id (str): The ID of the endpoint to filter traces.
    from_ (str): The start datetime in ISO 8601 format.
    to (str): The end datetime in ISO 8601 format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
app_idYes
from_Yes
toYes
endpoint_idYes

Implementation Reference

  • The main handler function for the MCP tool 'get_app_endpoint_traces'. It validates inputs via type hints, creates a duration object, and delegates to the ScoutAPI client to fetch traces for the specified app endpoint.
    @mcp.tool(name="get_app_endpoint_traces")
    async def get_app_endpoint_traces(
        app_id: int, from_: str, to: str, endpoint_id: str
    ) -> list[dict[str, Any]]:
        """
        Get recent traces for an app filtered to a specific endpoint.
    
        Args:
            app_id (int): The ID of the Scout APM application.
            endpoint_id (str): The ID of the endpoint to filter traces.
            from_ (str): The start datetime in ISO 8601 format.
            to (str): The end datetime in ISO 8601 format.
        """
        try:
            duration = scout_api.make_duration(from_, to)
            async with api_client as scout_client:
                traces = await scout_client.get_endpoint_traces(
                    app_id, endpoint_id, duration
                )
            return traces
        except scout_api.ScoutAPMError as e:
            return [{"error": str(e)}]
  • Supporting method in ScoutAPMAsync class that performs the actual API request to retrieve traces for a given app_id, endpoint_id, and time duration, including validation for time range.
    async def get_endpoint_traces(
        self,
        app_id: int,
        endpoint_id: str,
        duration: Duration,
    ) -> List[Dict[str, Any]]:
        """Get traces for a specific endpoint."""
        self._validate_time_range(duration)
    
        # Validate that from_time is not older than 7 days
        seven_days_ago = datetime.now(tz=timezone.utc) - timedelta(days=7)
        if duration.start < seven_days_ago:
            raise ValueError("from_time cannot be older than 7 days")
    
        response = await self._make_request(
            "GET",
            f"apps/{app_id}/endpoints/{endpoint_id}/traces",
            params=self._get_duration_params(duration),
        )
        return response.get("results", {}).get("traces", [])

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