get_app_metrics
Retrieve performance metrics for a specific application to analyze response times, throughput, and other key indicators within a defined time period.
Instructions
Get individual metric data for a specific application.
Args:
app_id (int): The ID of the Scout APM application.
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 | ||
| metric | Yes | ||
| from_ | Yes | ||
| to | Yes |
Implementation Reference
- scout_mcp/server.py:161-195 (handler)MCP tool handler implementation for 'get_app_metrics'. Uses Scout API to fetch metric data for a specific app, validates metric, handles errors, and formats response with series data.@mcp.tool(name="get_app_metrics") async def get_app_metric( app_id: int, metric: str, from_: str, to: str ) -> dict[str, Any]: """Get individual metric data for a specific application. Args: app_id (int): The ID of the Scout APM application. 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. """ if metric not in scout_api.VALID_METRICS: return { "error": f"Invalid metric '{metric}'. " f"Valid metrics are: {', '.join(scout_api.VALID_METRICS)}" } try: async with api_client as scout_client: data = await scout_client.get_metric_data(app_id, metric, from_, to) except scout_api.ScoutAPMError as e: return {"error": str(e)} if metric not in data or not data[metric]: return {"error": f"No data available for metric {metric}"} series = data[metric] return { "app_id": app_id, "metric": metric, "duration": f"{from_} to {to}", "data_points": len(series), "series": series, }