Skip to main content
Glama

attach

Connect to a running Go process by specifying its Process ID to enable debugging operations through the Delve debugger interface.

Instructions

Attach to a running process

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidYesProcess ID to attach to

Implementation Reference

  • The core handler logic for the 'attach' tool. It validates the 'pid' argument, calls startDebugSession to attach to the process, and returns a confirmation message with the session ID.
    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}`
        }]
      };
    }
  • src/server.ts:86-98 (registration)
    Tool registration entry for 'attach', defining the tool name, description, and input schema (requiring a numeric 'pid').
      name: "attach",
      description: "Attach to a running process",
      inputSchema: {
        type: "object",
        properties: {
          pid: {
            type: "number",
            description: "Process ID to attach to"
          }
        },
        required: ["pid"]
      }
    },
  • src/server.ts:406-408 (registration)
    Routing logic in the main request handler that dispatches 'attach' tool calls to handleDebugCommands in debug.ts.
    if (["debug", "attach", "exec", "test", "core", "dap", "replay", "trace"].includes(name)) {
      return handleDebugCommands(name, args);
    }
  • Type definition for DebugSession 'type' field that includes 'attach' as a valid mode.
    type: string; // 'debug' | 'attach' | 'exec' | 'test' | 'core' | 'replay' | 'trace' | 'dap'
    target: string;

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