Skip to main content
Glama

list_globals

Retrieve and paginate all global variables from a database in IDA Pro for efficient reverse engineering analysis.

Instructions

List all globals in the database (paginated)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countYesNumber of globals to list (100 is a good default, 0 means remainder)
offsetYesOffset to start listing from (start at 0)

Implementation Reference

  • Handler function implementing the list_globals tool. Collects global variables from IDA's Names(), filters non-function named addresses, applies pagination and pattern filtering.
    @tool
    @idaread
    def list_globals(
        queries: Annotated[
            list[ListQuery] | ListQuery | str,
            "List global variables with optional filtering and pagination",
        ],
    ) -> list[Page[Global]]:
        """List globals"""
        queries = normalize_dict_list(
            queries, lambda s: {"offset": 0, "count": 50, "filter": s}
        )
        all_globals: list[Global] = []
        for addr, name in idautils.Names():
            if not idaapi.get_func(addr) and name is not None:
                all_globals.append(Global(addr=hex(addr), name=name))
    
        results = []
        for query in queries:
            offset = query.get("offset", 0)
            count = query.get("count", 100)
            filter_pattern = query.get("filter", "")
    
            # Treat empty/"*" filter as "all"
            if filter_pattern in ("", "*"):
                filter_pattern = ""
    
            filtered = pattern_filter(all_globals, filter_pattern, "name")
            results.append(paginate(filtered, offset, count))
    
        return results
  • Output item schema: Global TypedDict defining structure of each global variable (address and name). Used in Page[Global].
    class Global(TypedDict):
        addr: str
        name: str
  • Input schema: ListQuery TypedDict for optional filter, offset, and count parameters supporting pagination and filtering.
    class ListQuery(TypedDict, total=False):
        """Pagination query for listing operations"""
    
        filter: Annotated[str, "Optional glob pattern to filter results"]
        offset: Annotated[int, "Starting index (default: 0)"]
        count: Annotated[int, "Maximum number of results (default: 50, 0 for all)"]
  • Pagination response wrapper: Page generic TypedDict used for output structure list[Page[Global]].
    class Page(TypedDict, Generic[T]):
        data: list[T]
        next_offset: Optional[int]
  • The @tool decorator registers functions as MCP tools by adding them to the McpServer instance.
    def tool(func):
        return MCP_SERVER.tool(func)

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/mrexodia/ida-pro-mcp'

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