get-replay
Retrieve session replay data from Rollbar to analyze user interactions and diagnose application errors by specifying environment, session, and replay identifiers.
Instructions
Get replay data for a specific session replay in Rollbar
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| environment | Yes | Environment name (e.g., production) | |
| sessionId | Yes | Session identifier that owns the replay | |
| replayId | Yes | Replay identifier to retrieve | |
| delivery | No | How to return the replay payload. Defaults to 'file' (writes JSON to a temp file); 'resource' returns a rollbar:// link. | |
| project | No | Project name (optional when only one project is configured) |
Implementation Reference
- src/tools/get-replay.ts:56-141 (handler)The tool "get-replay" is defined and registered here within the registerGetReplayTool function. It handles fetching replay data from Rollbar and returning it either as a file or a resource link.
export function registerGetReplayTool(server: McpServer) { server.tool( "get-replay", "Get replay data for a specific session replay in Rollbar", { environment: z .string() .min(1) .describe("Environment name (e.g., production)"), sessionId: z .string() .min(1) .describe("Session identifier that owns the replay"), replayId: z.string().min(1).describe("Replay identifier to retrieve"), delivery: DELIVERY_MODE.optional().describe( "How to return the replay payload. Defaults to 'file' (writes JSON to a temp file); 'resource' returns a rollbar:// link.", ), project: buildProjectParam(), }, async ({ environment, sessionId, replayId, delivery, project }) => { const deliveryMode = delivery ?? "file"; const { token, apiBase } = resolveProject(project); if (deliveryMode === "resource" && PROJECTS.length > 1) { throw new Error( 'delivery="resource" is not supported when multiple projects are configured. Use delivery="file" and specify the project parameter instead.', ); } const replayData = await fetchReplayData( environment, sessionId, replayId, token, apiBase, ); const resourceUri = buildReplayResourceUri( environment, sessionId, replayId, ); cacheReplayData(resourceUri, replayData); if (deliveryMode === "file") { const filePath = await writeReplayToFile( replayData, environment, sessionId, replayId, ); return { content: [ { type: "text", text: `Replay ${replayId} for session ${sessionId} in ${environment} saved to ${filePath}. This file is not automatically deleted—remove it when finished or rerun with delivery="resource" for a rollbar:// link.`, }, ], }; } return { content: [ { type: "text", text: `Replay ${replayId} for session ${sessionId} in ${environment} is available as ${resourceUri}. Use read-resource to download the JSON payload.`, }, { type: "resource_link", name: resourceUri, title: `Replay ${replayId}`, uri: resourceUri, description: buildResourceLinkDescription( environment, sessionId, replayId, ), mimeType: "application/json", }, ], }; }, ); }