Skip to main content
Glama
sbergeron42

gdb-multiarch-mcp

by sbergeron42

gdb_evaluate_expression

Evaluate C/C++ expressions during debugging sessions to inspect variables, test calculations, or check memory values while debugging Nintendo Switch executables.

Instructions

Evaluate a C/C++ expression.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionYesC/C++ expression to evaluate

Implementation Reference

  • Implementation of evaluate_expression in GDBSession class.
    def evaluate_expression(self, expression: str) -> dict[str, Any]:
        """
        Evaluate an expression in the current context.
    
        Args:
            expression: C/C++ expression to evaluate
    
        Returns:
            Dict with evaluation result
        """
        result = self.execute_command(f'-data-evaluate-expression "{expression}"')
    
        if result["status"] == "error":
            return result
    
        mi_result = self._extract_mi_result(result) or {}
        value = mi_result.get("value")
    
        return {"status": "success", "expression": expression, "value": value}
  • Registration of gdb_evaluate_expression tool in the MCP server.
    Tool(
        name="gdb_evaluate_expression",
        description="Evaluate a C/C++ expression.",
        inputSchema=EvaluateExpressionArgs.model_json_schema(),
    ),
  • Schema definition for evaluate_expression tool arguments.
    class EvaluateExpressionArgs(BaseModel):
  • Handler logic in server.py that calls evaluate_expression on the session.
    elif name == "gdb_evaluate_expression":
        a = EvaluateExpressionArgs(**arguments)
        result = session.evaluate_expression(a.expression)
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It fails to mention whether evaluation can modify program state (side effects), what frame/thread context applies, error handling for invalid syntax, or the return format (especially critical given no output schema exists).

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?

While the single sentence is not verbose, it suffers from under-specification rather than efficient conciseness. It restates the tool name without adding value, leaving significant gaps in information density that a debugging tool description should provide.

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 no annotations and no output schema, the description is insufficient. It lacks essential operational context: whether the expression evaluation is read-only or can mutate state, what it returns, and how it handles errors. The 100% input schema coverage is the only redeeming factor preventing a lower score.

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?

With 100% schema description coverage ('C/C++ expression to evaluate'), the schema fully documents the single parameter. The description adds no additional semantic information (e.g., examples of valid expressions, syntax constraints), warranting the baseline score for high-coverage schemas.

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

Purpose3/5

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

The description states a clear verb ('Evaluate') and resource ('C/C++ expression'), but offers minimal scope clarification (e.g., in which frame/thread context). It relies heavily on the tool name to convey meaning and does not differentiate from siblings like 'gdb_call_function' or 'gdb_execute_command' that might overlap in functionality.

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 such as 'gdb_execute_command' (for raw GDB CLI) or 'gdb_call_function'. It omits critical context such as prerequisites (e.g., program must be stopped) or warnings about side effects in expressions.

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/sbergeron42/gdb-multiarch-mcp'

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