Skip to main content
Glama

Run IDA Python analysis

execute_python

Run Python (IDAPython/ida-domain) against the binary open in IDA to decompile, disassemble, inspect xrefs, manage types, rename symbols, add comments, and patch bytes.

Instructions

Run Python (IDAPython and the ida-domain API) against the binary open in IDA: decompile a function to Hex-Rays pseudocode, disassemble (disasm) instructions, enumerate functions, strings, imports, exports, symbols, segments and sections, find cross references (xrefs to/from an address, callers, callees, call graph), get the function at an address, inspect or apply types and structs, rename functions and variables, add comments, and patch bytes. Returns the result plus stdout/stderr. Look up API names with reference first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesPython code that runs against an already-open database. Call reference(query) first; do not guess the API shape. `db` is the current ida-domain Database, and `ida_domain` is also imported globally. Imports, variables, and definitions persist for this agent's database lease. A single or trailing expression is returned. For function-style code, define run(db), execute(db), or main(db); it is invoked automatically when there is no trailing expression.
timeoutNoPython execution timeout in seconds. This does not include the separate initial autoanalysis wait.
instance_idNoOptional database instance id. If omitted, use the current target.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
stderrYes
stdoutYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv20261008.0.1

TDQS

A4.6/5.0
Behavior5/5

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

Since no annotations were provided, the description carries the full burden of behavioral transparency. It details critical operational characteristics such as returning 'the result plus stdout/stderr,' and importantly, that 'Imports, variables, and definitions persist for this agent's database lease.'

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?

The description suffers from being a massive, highly detailed feature list, making it lengthy. However, given the nature of an arbitrary execution tool, the high density of crucial information justifies keeping it from a lower score.

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

Completeness5/5

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

The description is extremely complete for such a complex execution tool. It defines the operational scope (what can be done), the environment constraints (persistence, APIs), the input format, and the output behavior (result + I/O streams).

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

Parameters5/5

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

Although schema coverage is 100%, the description adds deep semantic value to the `code` parameter. It specifies architectural requirements for writing code, such as using `run(db)` or `execute(db)` for function-style code, and defining the scope of the global variables (`db`, `ida_domain`).

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 defines the tool as a general execution engine for IDA Python (IDAPython and ida-domain API). It distinguishes itself from specialized sibling tools (like `decompile` or `patch`) by providing a comprehensive list of arbitrary analysis capabilities the code can perform.

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 provides essential usage guidance by advising the agent to 'Look up API names with reference first.' Furthermore, the input schema reinforces this by stating, 'Call reference(query) first; do not guess the API shape,' guiding the agent on workflow.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.