Skip to main content
Glama

replay

Replay recorded rr trace files to debug and analyze Go program execution, enabling step-by-step inspection of code behavior.

Instructions

Replay an rr trace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tracePathYesPath to the rr trace directory
onProcessNoOptional PID to pass to rr

Implementation Reference

  • Handler function for debug tools. The 'replay' tool is routed here from server.ts, but lacks a specific switch case and would throw 'Unknown debug command'.
    export async function handleDebugCommands(name: string, args: any) {
      switch (name) {
        case "debug": {
          const pkg = (args?.package as string) || ".";
          const buildFlags = args?.buildFlags as string | undefined;
          const cmdArgs: string[] = [];
          
          if (buildFlags) {
            cmdArgs.push("--build-flags", buildFlags);
          }
    
          const session = await startDebugSession("debug", pkg, cmdArgs);
          return {
            content: [{
              type: "text",
              text: `Started debug session ${session.id} for package ${pkg}`
            }]
          };
        }
    
        case "attach": {
          const pid = Number(args?.pid);
          if (!pid) {
            throw new Error("Process ID is required");
          }
    
          const session = await startDebugSession("attach", pid.toString());
          return {
            content: [{
              type: "text",
              text: `Attached to process ${pid} with session ${session.id}`
            }]
          };
        }
    
        case "exec": {
          const binary = String(args?.binary);
          const cmdArgs = (args?.args as string[]) || [];
    
          const session = await startDebugSession("exec", binary, cmdArgs);
          return {
            content: [{
              type: "text",
              text: `Started debug session ${session.id} for binary ${binary}`
            }]
          };
        }
    
        case "test": {
          const pkg = (args?.package as string) || ".";
          const testFlags = (args?.testFlags as string[]) || [];
    
          const session = await startDebugSession("test", pkg, ["--", ...testFlags]);
          return {
            content: [{
              type: "text",
              text: `Started test debug session ${session.id} for package ${pkg}`
            }]
          };
        }
    
        case "core": {
          const { executable, corePath } = args;
          const session = await startDebugSession("core", executable, [corePath]);
          return {
            content: [{
              type: "text",
              text: `Started core dump analysis session ${session.id} for ${executable} with core ${corePath}`
            }]
          };
        }
    
        case "dap": {
          const { clientAddr } = args;
          const cmdArgs = clientAddr ? ["--client-addr", clientAddr] : [];
          
          const session = await startDebugSession("dap", "", cmdArgs);
          return {
            content: [{
              type: "text",
              text: `Started DAP server session ${session.id}${clientAddr ? ` connecting to ${clientAddr}` : ''}`
            }]
          };
        }
    
        default:
          throw new Error("Unknown debug command");
      }
  • Input schema for the 'replay' MCP tool, defining tracePath as required and onProcess as optional.
    {
      name: "replay",
      description: "Replay an rr trace",
      inputSchema: {
        type: "object",
        properties: {
          tracePath: {
            type: "string",
            description: "Path to the rr trace directory"
          },
          onProcess: {
            type: "number",
            description: "Optional PID to pass to rr"
          }
        },
        required: ["tracePath"]
      }
    },
  • src/server.ts:405-408 (registration)
    Registration logic in CallToolRequest handler that routes calls to the 'replay' tool to the debug handler.
    // Debug commands
    if (["debug", "attach", "exec", "test", "core", "dap", "replay", "trace"].includes(name)) {
      return handleDebugCommands(name, args);
    }
  • Type definition for DebugSession.type includes 'replay'.
    type: string; // 'debug' | 'attach' | 'exec' | 'test' | 'core' | 'replay' | 'trace' | 'dap'
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions 'replay' but doesn't disclose behavioral traits such as whether it's read-only, destructive, requires specific permissions, or has side effects like executing code. This leaves critical operational details unspecified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with a single phrase, 'Replay an rr trace', which is front-loaded and wastes no words. However, it may be overly terse, lacking necessary detail for clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity implied by 'replay' (likely involving execution or debugging of traces), no annotations, no output schema, and siblings like 'debug', the description is incomplete. It fails to explain what 'replay' entails, expected outcomes, or how it interacts with other tools, leaving significant gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('tracePath' and 'onProcess'). The description adds no additional meaning beyond the schema, such as explaining what 'replay' does with these inputs or providing usage examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Replay an rr trace' clearly states the verb ('replay') and resource ('rr trace'), but it's vague about what 'replay' entails—does it execute, debug, or analyze the trace? It doesn't distinguish from siblings like 'trace' or 'debug', leaving ambiguity in purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'trace', 'debug', and 'continue', there's no indication of context, prerequisites, or exclusions, making it unclear how this tool fits into the workflow.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/dwisiswant0/delve-mcp'

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