Skip to main content
Glama

exec

Debug a precompiled Go binary by executing it with given arguments.

Instructions

Debug a precompiled binary

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
binaryYesPath to the binary
argsNoArguments to pass to the binary

Implementation Reference

  • Handler for the 'exec' tool - starts a debugging session for a precompiled binary by calling startDebugSession with type 'exec', the binary path, and any additional args.
    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}`
        }]
      };
    }
  • Input schema for the 'exec' tool registration - defines binary (string, required) and args (array of strings, optional) parameters.
    {
      name: "exec",
      description: "Debug a precompiled binary",
      inputSchema: {
        type: "object",
        properties: {
          binary: {
            type: "string",
            description: "Path to the binary"
          },
          args: {
            type: "array",
            items: { type: "string" },
            description: "Arguments to pass to the binary"
          }
        },
        required: ["binary"]
      }
    },
  • src/server.ts:402-408 (registration)
    Routes the 'exec' tool name to handleDebugCommands via the CallToolRequestSchema handler.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      // Debug commands
      if (["debug", "attach", "exec", "test", "core", "dap", "replay", "trace"].includes(name)) {
        return handleDebugCommands(name, args);
      }
  • Helper function startDebugSession used by the exec handler - spawns a delve process with type 'exec' and the binary target.
    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;
    }
  • Type definition for DebugSession where 'exec' is a valid session type in the union type.
    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[];
Behavior2/5

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

With no annotations, the description must disclose behavioral traits. It only says 'debug', which implies execution under a debugger, but does not specify side effects, state changes, or prerequisites.

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

Conciseness3/5

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

Description is extremely concise (one sentence), but this brevity sacrifices informativeness. It is not overly verbose, but could include more structured detail.

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?

For a debugging tool with 2 parameters and no output schema, the description lacks critical context such as return values, termination behavior, and interaction with the debugger state.

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 has 100% parameter description coverage, so the description adds no extra meaning. Baseline score of 3 is appropriate.

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

Purpose4/5

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

Description clearly states the tool debugs a precompiled binary, which is specific and action-oriented. However, it does not differentiate from sibling tool 'debug', which likely performs a similar role.

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 provided on when to use 'exec' versus alternative tools like 'debug' or 'attach'. The description offers no context for appropriate usage.

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