MCP decode_stack_trace
Description
Decode a Roku TypeScript stack trace from Hermes bytecode (index.hbc) or JS bundle (index.js) to original TypeScript source locations.
Accepts raw stack trace text that may include surrounding log noise -- only lines containing .hbc or .js frames are processed.
The tool auto-detects the source map SHA from the input when present (source_map_sha=... or [SourceMap: ...]). If no SHA is found, it uses the most recent local build artifacts.
Supports multi-bundle stacks from TypeScript DCLs (Dynamic Component Libraries). When a DCL is loaded, stack frames appear as tsDCL.hbc:1:N (where tsDCL is the DCL library name). Pass the DCL dist directory via dclDirs to decode these frames from the DCL's own source maps.
Returns decoded frames with original source file, line, column, function name, and surrounding source context.
Example input: at renderComponent (index.hbc🔢56) at updateView (index.hbc:890:12)
Example output frame: { "original": " at renderComponent (index.hbc🔢56)", "function": "renderComponent", "source": "src/components/Grid.tsx", "line": 45, "column": 12, "name": null, "context": " > 45 | const items = data.map(...)", "error": null }
See also
- HTTP decodeStack (
POST /api/decode-stack) - rk decode-stack
Parameters
additionalProperties: false
| Name | Type | Required | Values |
|---|---|---|---|
| stackTrace | string | Yes | minLength: 1; maxLength: 500000 |
| sha | string | No | |
| buildDir | string | No | |
| context | number | No | default: 2; minimum: 0; maximum: 50 |
| dclDirs | object<string, string> | No | additionalProperties: string |
stackTrace
Raw stack trace text (can include log noise -- only .hbc/.js frames are extracted)
sha
Source map SHA256 hash (optional, auto-detected from input text)
buildDir
Build directory path containing source maps (optional, auto-detects dist-dev or dist-build)
context
Lines of source context around each frame (default: 2, max: 50)
dclDirs
Maps DCL library name to its build directory for multi-bundle decoding. Example: { "tsDCL": "/workspace/apps/ts-dcl/dist-build" }
dclDirs fields
| Name | Type | Required | Values | Description |
|---|---|---|---|---|
| dclDirs.* | string | No | Not documented in the source. |
Updated about 5 hours ago