Skip to main content
Glama

test

Debug and test Go packages with custom flags using Delve MCP, enabling precise code analysis and troubleshooting in a TypeScript-based environment.

Instructions

Debug tests in a package

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
packageNoPackage to test (defaults to current directory)
testFlagsNoFlags to pass to go test

Implementation Reference

  • The handler function for the 'test' tool. Extracts parameters (package and testFlags), starts a Delve debug session for Go tests, and returns a success message with session ID.
    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}` }] }; }
  • Defines the input schema, name, and description for the 'test' tool, used in tool listing.
    { name: "test", description: "Debug tests in a package", inputSchema: { type: "object", properties: { package: { type: "string", description: "Package to test (defaults to current directory)" }, testFlags: { type: "array", items: { type: "string" }, description: "Flags to pass to go test" } } } },
  • src/server.ts:406-408 (registration)
    Registers the 'test' tool by checking the tool name in the CallToolRequestHandler and dispatching to handleDebugCommands.
    if (["debug", "attach", "exec", "test", "core", "dap", "replay", "trace"].includes(name)) { return handleDebugCommands(name, args); }
  • Core helper function that spawns the Delve debugger process (dlv) with the 'test' mode, target package, and test flags, creating and registering a debug session.
    export async function startDebugSession(type: string, target: string, args: string[] = []): Promise<DebugSession> { const port = await getAvailablePort(); const id = Math.random().toString(36).substring(7); const dlvArgs = [ type, "--headless", `--listen=:${port}`, "--accept-multiclient", "--api-version=2", target, ...args ]; const process = spawn("dlv", dlvArgs, { stdio: ["pipe", "pipe", "pipe"] }); const session: DebugSession = { id, type, target, process, port, breakpoints: new Map() }; sessions.set(id, session); return session; }

Other Tools

Related 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