get_endpoint_metrics
Retrieve performance metrics like response time or throughput for specific application endpoints within a defined time period to monitor and analyze endpoint behavior.
Instructions
Get a single timeseries metric for a specific endpoint in an application.
Args:
app_id (int): The ID of the Scout APM application.
endpoint (str): The endpoint path (e.g., "/users", "/orders").
metric (str): The metric to retrieve (e.g., "response_time", "throughput").
from_ (str): The start datetime in ISO 8601 format.
to (str): The end datetime in ISO 8601 format.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | ||
| endpoint | Yes | ||
| from_ | Yes | ||
| metric | Yes | ||
| to | Yes |
Implementation Reference
- scout_mcp/server.py:225-261 (handler)MCP tool handler decorated with @mcp.tool(name="get_endpoint_metrics"). Executes the tool logic by calling the Scout API client to fetch endpoint-specific metric timeseries data, formats the response, and handles errors.@mcp.tool(name="get_endpoint_metrics") async def get_endpoint_metric( app_id: int, endpoint: str, metric: str, from_: str, to: str ) -> dict[str, Any]: """ Get a single timeseries metric for a specific endpoint in an application. Args: app_id (int): The ID of the Scout APM application. endpoint (str): The endpoint path (e.g., "/users", "/orders"). metric (str): The metric to retrieve (e.g., "response_time", "throughput"). 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: data = await scout_client.get_endpoint_metric( app_id, endpoint, metric, duration ) except Exception as e: return {"error": str(e)} if metric not in data or not data[metric]: return { "error": f"No data available for endpoint {endpoint} and metric {metric}" } series = data[metric] return { "app_id": app_id, "endpoint": endpoint, "metric": metric, "duration": f"{from_} to {to}", "data_points": len(series), "series": series, }
- scout_mcp/scout_api.py:271-286 (helper)Helper method in ScoutAPMAsync client that makes the HTTP GET request to the Scout APM API to retrieve the specific endpoint metric data. Includes validation and response parsing.async def get_endpoint_metric( self, app_id: int, endpoint_id: str, metric: str, duration: Duration, ) -> List[str]: """Get metric data for a specific endpoint.""" self._validate_metric_params(metric, duration) response = await self._make_request( "GET", f"apps/{app_id}/endpoints/{endpoint_id}/metrics/{metric}", params=self._get_duration_params(duration), ) return response.get("results", {}).get("series", {}).get(metric, [])
- scout_mcp/scout_api.py:30-37 (schema)Set of valid metric names used for input schema validation in the get_endpoint_metric helper.VALID_METRICS = { "response_time", "response_time_95th", "errors", "throughput", "queue_time", "apdex", }
- scout_mcp/server.py:225-225 (registration)Decorator registering the get_endpoint_metric function as an MCP tool named 'get_endpoint_metrics'.@mcp.tool(name="get_endpoint_metrics")