get_app_trace
Retrieve detailed application performance traces with all spans to analyze and debug performance issues like slow endpoints and N+1 queries.
Instructions
Get an individual trace with all spans.
Args:
app_id (int): The ID of the Scout APM application.
trace_id (int): The ID of the trace to retrieve.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | ||
| trace_id | Yes |
Implementation Reference
- scout_mcp/server.py:288-302 (handler)The main handler function for the 'get_app_trace' MCP tool. Decorated with @mcp.tool for registration. Fetches the trace data using the ScoutAPMAsync client and handles API errors.@mcp.tool(name="get_app_trace") async def get_app_trace(app_id: int, trace_id: int) -> dict[str, Any]: """ Get an individual trace with all spans. Args: app_id (int): The ID of the Scout APM application. trace_id (int): The ID of the trace to retrieve. """ try: async with api_client as scout_client: trace = await scout_client.get_trace(app_id, trace_id) return trace except scout_api.ScoutAPMError as e: return {"error": str(e)}
- scout_mcp/scout_api.py:308-315 (helper)Supporting method in ScoutAPMAsync class that implements the core logic: makes an HTTP GET request to the Scout API endpoint /apps/{app_id}/traces/{trace_id} and extracts the trace data from the response.async def get_trace(self, app_id: int, trace_id: int) -> Dict[str, Any]: """Get a specific trace with all its spans.""" response = await self._make_request( "GET", f"apps/{app_id}/traces/{trace_id}", ) return response.get("results", {}).get("trace", {})