Skip to main content
Glama
TomMelt

HPC-MCP

by TomMelt

debug_crash

Debug crashing programs by analyzing stack traces to identify root causes of failures in HPC environments.

Instructions

Debug crashing program and return the stack trace.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYes
argsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'debug_crash' tool. It generates a GDB command, executes it via subprocess, parses the backtrace from the output, and returns it.
    def debug_crash(target: str, args: list[str]) -> str:
        """Debug crashing program and return the stack trace."""
    
        debug_cmd = generate_debug_cmd(target, args)
        debug_output = subprocess.run(shlex.split(debug_cmd), capture_output=True)
        backtrace_text = parse_backtrace(debug_output)
        return backtrace_text
  • Function signature providing input/output type hints serving as the tool schema: target (str), args (list[str]) -> str.
    def debug_crash(target: str, args: list[str]) -> str:
  • src/debug.py:8-8 (registration)
    Decorator registering the debug_crash function as an MCP tool.
    @mcp.tool
  • Helper function to construct the GDB command for batch mode execution, backtrace, and quit.
    def generate_debug_cmd(target: str, args: list[str]) -> str:
        """Generate a debug command for the target program with args."""
        crash_script = shlex.split("--batch -ex b _exit -ex run -ex bt -ex quit")
        general_gdb_config = "-q"
        debug_cmd = shlex.join(
            ["gdb", general_gdb_config] + crash_script + ["--args", target] + args
        )
        return debug_cmd
  • Helper function to extract backtrace lines (starting with '#') from GDB output.
    def parse_backtrace(debug_output: subprocess.CompletedProcess[bytes]) -> str:
        """Parse the backtrace from the output of gdb."""
        raw_text = debug_output.stdout.decode("utf-8")
        backtrace = "\n".join(
            line for line in raw_text.splitlines() if line.startswith("#")
        )
        return backtrace
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that the tool returns a stack trace, which is useful, but fails to describe critical traits like whether it requires specific permissions, if it's read-only or destructive, how it handles errors, or any rate limits. For a tool that interacts with a program (potentially involving execution), this is a significant gap in transparency.

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 extremely concise—a single sentence that directly states the tool's action and output without any fluff. It is front-loaded with the core purpose, making it efficient for quick understanding. Every word earns its place, adhering to best practices for brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (involving program debugging), lack of annotations, and 0% schema description coverage, the description is incomplete. It mentions the output (stack trace), and an output schema exists, which helps, but it misses critical context like behavioral traits and parameter meanings. This makes it minimally adequate but with clear gaps for effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for the lack of parameter documentation. It does not explain what 'target' or 'args' represent (e.g., target could be a file path or process ID, args might be command-line arguments), their formats, or examples. This leaves the parameters largely ambiguous, reducing the tool's usability despite the schema defining their types.

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 tool's purpose with a specific verb ('debug') and resource ('crashing program'), and specifies the output ('return the stack trace'). It distinguishes the action from generic debugging by focusing on crash analysis. However, without sibling tools, differentiation isn't tested, preventing a perfect score.

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, prerequisites, or constraints. It states what the tool does but offers no context for its application, such as when debugging is appropriate or what types of crashes it handles. This lack of usage context limits its helpfulness for an agent.

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/TomMelt/hpc-mcp'

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