Skip to main content
Glama
scoutapp

Scout Monitoring MCP

Official

get_app_metrics

Retrieve specific application performance metrics like response time and throughput from Scout Monitoring for any date range to analyze performance trends and identify issues.

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
NameRequiredDescriptionDefault
app_idYes
from_Yes
metricYes
toYes

Implementation Reference

  • The primary handler function for the 'get_app_metrics' tool. Validates the metric against VALID_METRICS, fetches data via the ScoutAPI client, handles errors, and returns formatted time 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, }
  • Set of valid metrics supported by the Scout APM API, used for input validation in the get_app_metrics handler.
    VALID_METRICS = { "response_time", "response_time_95th", "errors", "throughput", "queue_time", "apdex", }
  • Supporting function in the Scout API client that performs the HTTP request to fetch metric data from the Scout APM API, including validation and formatting.
    async def get_metric_data( self, app_id: int, metric_type: str, duration: Duration ) -> Dict[str, List]: """Get time series data for a specific metric.""" self._validate_metric_params(metric_type, duration) from_, to = (_format_time(duration.start), _format_time(duration.end)) params = {"from": from_, "to": to} response = await self._make_request( "GET", f"apps/{app_id}/metrics/{metric_type}", params=params ) return response.get("results", {}).get("series", {})
  • MCP tool registration decorator specifying the tool name 'get_app_metrics'.
    @mcp.tool(name="get_app_metrics")
  • Validation helper ensuring the metric type is valid and time range constraints are met.
    def _validate_metric_params(self, metric_type: str, duration: Duration): """Validate metric parameters. Checks that metric_type is valid and that the time range does not exceed 2 weeks. """ if metric_type not in VALID_METRICS: raise ValueError( f"Invalid metric_type. Must be one of: {', '.join(VALID_METRICS)}" ) # Validate time range (2 week maximum) self._validate_time_range(duration) def _validate_time_range(self, duration: Duration): """Validate time ranges. Cannot exceed 2 weeks and from_time must be before to_time.""" if duration.start >= duration.end: raise ValueError("from_time must be before to_time") if duration.end - duration.start > timedelta(days=14): raise ValueError("Time range cannot exceed 2 weeks")

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