Skip to main content
Glama
HexRaysSA

IDA MCP

Official
by HexRaysSA

execute_python

Run Python code against an open IDA database to query or modify binary analysis, returning the result and captured stdout/stderr for reverse engineering workflows.

Instructions

Execute Python and return its result plus captured stdout and stderr.

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
Behavior5/5

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

With no annotations, the description fully carries the burden and does so well: it discloses cross-call persistence, automatic invocation of run(db)/execute(db)/main(db), single/trailing expression return, captured stdout/stderr, and timeout behavior excluding the autoanalysis wait. This goes well beyond typical 'executes code' descriptions.

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?

The main description is one focused sentence with the key output promise front-loaded, and the longer parameter descriptions are dense but organized around distinct semantics. No filler or repetition of the schema.

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?

The definition is nearly complete: it explains environment, state persistence, invocation conventions, timeout, target selection, and output capture, and the output schema covers return shape. It lacks an explicit warning that arbitrary Python may mutate the database or cause side effects, which is more salient because no annotations exist.

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?

All three parameters are described with 100% coverage, and the code parameter description adds substantial operational meaning: the execution environment, available globals (db, ida_domain), required reference() pattern, persistence, and return conventions. The timeout and instance_id descriptions also clarify defaults and exclusions.

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?

States a specific action ('Execute Python') and return behavior ('result plus captured stdout and stderr'), which clearly differentiates it from the database-lifecycle siblings. The function-style invocation rules in the code parameter further pin down what the tool does.

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?

Explicitly instructs the agent to call reference(query) first and not guess the API shape, and states that code runs against an already-open database. It does not explicitly contrast with siblings, but the prerequisite and persistence guidance give clear context.

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

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