Skip to main content
Glama

gdb_get_frame_info

Obtain details of the current stack frame: function name, file location, line number, and address. Use with a session ID from gdb_start_session. Optionally select another frame with gdb_select_frame first.

Instructions

Get information about the current stack frame. Returns details about the currently selected frame including function name, file location, line number, and address. Use gdb_select_frame to change the current frame first if needed. Requires session_id parameter (obtained from gdb_start_session).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYesSession ID from gdb_start_session

Implementation Reference

  • Handler function: sends '-stack-info-frame' GDB/MI command, extracts the frame data from the response, and returns it as structured output.
    def get_frame_info(self) -> dict[str, Any]:
        """
        Get information about the current stack frame.
    
        Returns:
            Dict with current frame information
        """
        result = self.execute_command("-stack-info-frame")
    
        if result["status"] == "error":
            return result
    
        mi_result = self._extract_mi_result(result) or {}
        frame = mi_result.get("frame", {})
    
        return {"status": "success", "frame": frame}
  • Tool registration: defines the tool's name, description, and input schema (SessionIdArgs).
    Tool(
        name="gdb_get_frame_info",
        description=(
            "Get information about the current stack frame. "
            "Returns details about the currently selected frame including function name, "
            "file location, line number, and address. "
            "Use gdb_select_frame to change the current frame first if needed. "
            "Requires session_id parameter (obtained from gdb_start_session)."
        ),
        inputSchema=SessionIdArgs.model_json_schema(),
    ),
  • Dispatcher: routes the 'gdb_get_frame_info' tool name to session.get_frame_info() method call.
    elif name == "gdb_get_frame_info":
        result = session.get_frame_info()
  • Schema: SessionIdArgs defines the input schema (just session_id) used by gdb_get_frame_info.
    class SessionIdArgs(BaseModel):
        """Arguments for tools that only need session_id."""
    
        session_id: int = Field(..., description="Session ID from gdb_start_session")
Behavior3/5

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

No annotations are provided, so the description carries full behavioral burden. It states the tool returns details and requires a session_id, but does not disclose behavior on error (e.g., invalid session ID, no current frame), side effects, or rate limits. This leaves some behavioral ambiguity.

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?

Two sentences, front-loaded with the action, no wasted words. Every sentence adds value: purpose, returns, prerequisite, and usage hint.

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

Completeness4/5

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

Given low complexity (1 param, no output schema), the description covers purpose, return fields, and usage context. It lacks explicit details on error cases or return format (e.g., data types), but is sufficient for an experienced user.

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% (session_id documented in schema). The description adds no new parameter information beyond restating the prerequisite. Per guidelines, baseline is 3 when coverage is high.

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

Purpose5/5

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

The description clearly states the tool gets information about the current stack frame, listing specific return fields (function name, file location, line number, address). It distinguishes from siblings like gdb_get_backtrace (which gives entire stack) and gdb_select_frame (which changes the current frame).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly advises to use gdb_select_frame first to change the current frame if needed, and requires session_id from gdb_start_session. However, it does not explicitly rule out alternatives like gdb_get_backtrace for frame details, though the singular 'current frame' implies a single frame.

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/airfloats/gdb_mcp'

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