Skip to main content
Glama

debug

Debug Go packages by starting the Delve debugger to trace and analyze code execution, with options for specifying packages and build flags.

Instructions

Start debugging a Go package

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
packageNoPackage to debug (defaults to current directory)
buildFlagsNoBuild flags to pass to the compiler

Implementation Reference

  • Core handler logic for the 'debug' tool: parses arguments, starts a Delve debug session for the specified Go package, and returns session info.
    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}` }] }; }
  • Tool schema registration for 'debug': defines name, description, and input schema with optional 'package' and 'buildFlags' parameters.
    { name: "debug", description: "Start debugging a Go package", inputSchema: { type: "object", properties: { package: { type: "string", description: "Package to debug (defaults to current directory)" }, buildFlags: { type: "string", description: "Build flags to pass to the compiler" } } } },
  • src/server.ts:406-408 (registration)
    MCP CallToolRequest handler that registers and routes the 'debug' tool invocation to handleDebugCommands.
    if (["debug", "attach", "exec", "test", "core", "dap", "replay", "trace"].includes(name)) { return handleDebugCommands(name, args); }
  • Type definition for DebugSession used by the 'debug' tool implementation.
    export interface DebugSession { id: string; type: string; // 'debug' | 'attach' | 'exec' | 'test' | 'core' | 'replay' | 'trace' | 'dap' target: string; process?: ChildProcess; port: number; breakpoints: Map<number, Breakpoint>; logOutput?: string[]; backend?: 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