Skip to main content
Glama
rollbar

Rollbar MCP Server

Official
by rollbar

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
NameRequiredDescriptionDefault
environmentYesEnvironment name (e.g., production)
sessionIdYesSession identifier that owns the replay
replayIdYesReplay identifier to retrieve
deliveryNoHow to return the replay payload. Defaults to 'file' (writes JSON to a temp file); 'resource' returns a rollbar:// link.
projectNoProject name (optional when only one project is configured)

Implementation Reference

  • 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",
              },
            ],
          };
        },
      );
    }

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/rollbar/rollbar-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server