Skip to main content
Glama
sbergeron42

gdb-multiarch-mcp

by sbergeron42

gdb_get_variables

Retrieve local variables from a specific stack frame during Nintendo Switch debugging with gdb-multiarch.

Instructions

Get local variables for a stack frame.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thread_idNoThread ID (None for current)
frameNoFrame number (0 is current)

Implementation Reference

  • The implementation of get_variables which interacts with GDB/MI via commands -thread-select, -stack-select-frame, and -stack-list-variables.
    def get_variables(self, thread_id: Optional[int] = None, frame: int = 0) -> dict[str, Any]:
        """
        Get local variables for a specific frame.
    
        Args:
            thread_id: Thread ID (None for current)
            frame: Frame number (0 is current frame)
    
        Returns:
            Dict with variable information
        """
        # Switch thread if needed
        if thread_id is not None:
            thread_result = self.execute_command(f"-thread-select {thread_id}")
            if thread_result.get("status") == "error":
                return thread_result
    
        # Select frame
        frame_result = self.execute_command(f"-stack-select-frame {frame}")
        if frame_result.get("status") == "error":
            return frame_result
    
        # Get variables
        result = self.execute_command("-stack-list-variables --simple-values")
    
        if result["status"] == "error":
            return result
    
        mi_result = self._extract_mi_result(result) or {}
        variables = mi_result.get("variables", [])
    
        return {"status": "success", "thread_id": thread_id, "frame": frame, "variables": variables}
  • Tool registration for gdb_get_variables in the MCP server.
    Tool(
        name="gdb_get_variables",
        description="Get local variables for a stack frame.",
        inputSchema=GetVariablesArgs.model_json_schema(),
    ),
  • The tool handler branch that calls session.get_variables.
    elif name == "gdb_get_variables":
        a = GetVariablesArgs(**arguments)
        result = session.get_variables(thread_id=a.thread_id, frame=a.frame)
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. While 'Get' implies a read-only operation, the description does not confirm safety, disclose the return format (variable names, values, types), or mention error conditions (e.g., invalid frame numbers).

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

Conciseness4/5

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

The single sentence is efficient and front-loaded with the verb 'Get'. However, given the absence of annotations and output schema, the description is overly terse and misses essential behavioral context that would warrant a longer description.

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?

Given the lack of output schema and annotations, the description fails to compensate by describing return values, data structure, or GDB state requirements. For a debugging tool with complex state dependencies, this leaves critical gaps in the contract.

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%, establishing a baseline of 3. The description itself adds no parameter information beyond what the schema already provides (thread_id defaults to current, frame defaults to 0), but the schema is sufficiently self-documenting.

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 identifies the action ('Get') and resource ('local variables') with scope ('stack frame'). It implicitly distinguishes from siblings like gdb_get_registers or gdb_get_backtrace by specifying 'local variables', though it does not explicitly contrast with gdb_evaluate_expression.

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_evaluate_expression or prerequisites such as the program being paused. It lacks 'when-not-to-use' or prerequisite information.

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