Skip to main content
Glama
signal-slot

MCP GDB Server

by signal-slot

gdb_finish

Execute until the current function returns in a GDB debugging session. Simplify debugging by automatically stepping through code to the end of the function without manual intervention.

Instructions

Execute until the current function returns

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesGDB session ID

Implementation Reference

  • The main handler function for the 'gdb_finish' tool. It validates the session ID, retrieves the GDB session, executes the 'finish' GDB command via executeGdbCommand, and returns the output or error response.
    private async handleGdbFinish(args: any) {
      const { sessionId } = args;
      
      if (!activeSessions.has(sessionId)) {
        return {
          content: [
            {
              type: 'text',
              text: `No active GDB session with ID: ${sessionId}`
            }
          ],
          isError: true
        };
      }
      
      const session = activeSessions.get(sessionId)!;
      
      try {
        const output = await this.executeGdbCommand(session, "finish");
        
        return {
          content: [
            {
              type: 'text',
              text: `Finished current function\n\nOutput:\n${output}`
            }
          ]
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: 'text',
              text: `Failed to finish function: ${errorMessage}`
            }
          ],
          isError: true
        };
      }
    }
  • src/index.ts:255-268 (registration)
    Tool registration in the ListTools response. Defines the name 'gdb_finish', description, and input schema requiring 'sessionId'.
    {
      name: 'gdb_finish',
      description: 'Execute until the current function returns',
      inputSchema: {
        type: 'object',
        properties: {
          sessionId: {
            type: 'string',
            description: 'GDB session ID'
          }
        },
        required: ['sessionId']
      }
    },
  • Input schema for 'gdb_finish' tool, specifying an object with required 'sessionId' string property.
    inputSchema: {
      type: 'object',
      properties: {
        sessionId: {
          type: 'string',
          description: 'GDB session ID'
        }
      },
      required: ['sessionId']
    }
  • src/index.ts:381-382 (registration)
    Registration/dispatch in the CallToolRequestHandler switch statement that routes 'gdb_finish' calls to the handleGdbFinish method.
    case 'gdb_finish':
      return await this.handleGdbFinish(request.params.arguments);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does ('Execute until the current function returns') but doesn't describe side effects (e.g., whether it stops at return point, displays output, or requires debug session state), permissions, or error conditions.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero wasted words. It's appropriately sized for a simple execution control tool and front-loads the core functionality.

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 debugger execution tool with no annotations and no output schema, the description is incomplete. It doesn't explain what happens after execution (e.g., program state, output format), error handling, or how it interacts with other debugger tools in the sibling set.

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% (sessionId parameter is documented in schema), so baseline is 3. The description adds no parameter-specific information beyond what the schema provides about sessionId.

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?

The description clearly states the action ('Execute until') and target ('the current function returns'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from siblings like gdb_continue, gdb_next, or gdb_step, which are also execution control tools.

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?

The description provides no guidance on when to use this tool versus alternatives like gdb_continue (run until breakpoint) or gdb_step (execute one line). It mentions 'current function' but doesn't specify prerequisites (e.g., must be paused at a function call) or exclusions.

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

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/signal-slot/mcp-gdb'

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