get_app_endpoint_traces
Retrieve recent traces for a specific application endpoint to analyze performance issues and identify optimization opportunities within a defined time range.
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
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | ||
| endpoint_id | Yes | ||
| from_ | Yes | ||
| to | Yes |
Implementation Reference
- scout_mcp/server.py:264-286 (handler)MCP tool handler for 'get_app_endpoint_traces'. Registers the tool and implements the logic by converting time parameters to Duration and delegating to the Scout API 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)}]
- scout_mcp/scout_api.py:287-307 (helper)Core helper method in ScoutAPMAsync that performs API validation and HTTP request to retrieve traces for a specific endpoint.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", [])
- scout_mcp/scout_api.py:397-401 (helper)Utility function used by the tool handler to convert 'from_' and 'to' ISO datetime strings into a Duration object.def make_duration(from_: str, to: str) -> Duration: """Helper to create a Duration object from ISO 8601 strings.""" start = _parse_time(from_) end = _parse_time(to) return Duration(start=start, end=end)