Skip to main content
Glama
SuZiXunYue

IDA Script MCP

by SuZiXunYue

execute_idapython

Destructive

Execute Python code or script files within IDA Pro to automate binary analysis. Capture output and target specific IDA instances.

Instructions

Execute Python code or script file in IDA Pro context.

This tool sends Python code to the IDA Pro plugin for execution. The code runs in IDA's main thread with full access to all IDA API modules.

For long-running scripts, the tool polls for completion up to the timeout. If the timeout is exceeded, a task_id is returned so you can check status later using the check_task_status tool.

Args: params (ExecuteScriptInput): Validated input parameters containing: - code (Optional[str]): Python code string to execute - script_path (Optional[str]): Path to Python script file - capture_output (bool): Whether to capture stdout/stderr - instance_id (Optional[str]): Target IDA instance ID (e.g., "crackme.exe" or full ID) - port (Optional[int]): Target IDA instance port (e.g., 13338) - timeout (int): Maximum wait time in seconds (default: 600)

Returns: str: JSON-formatted string containing: - result: The return value of the last expression - stdout: Captured standard output - stderr: Captured standard output (including errors) - instance: The IDA instance that executed the code - task_id: Present if script is still running or timed out

Examples: # Execute on default instance execute_idapython(code="print(idaapi.get_root_filename())")

# Execute on specific instance by database name
execute_idapython(code="len(list(idautils.Functions()))", instance_id="crackme.exe")

# Execute on specific instance by port
execute_idapython(code="idc.get_func_name(0x401000)", port=13339)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

Beyond annotations (destructiveHint: true), the description details execution in IDA's main thread, polling with timeout, and returning a task_id for async status checks. No contradictions.

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 description is well-organized with clear sections (summary, execution behavior, Args, Returns, Examples). It is somewhat verbose but all content is necessary for a complex tool.

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 covers all aspects: execution context, timeout handling, return format (result, stdout, stderr, instance, task_id), and examples. No gaps given the tool's complexity and available annotations.

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?

Despite schema having partial descriptions, the description's Args block adds valuable context: default values, the mutual exclusivity of code and script_path, and timeout behavior. Examples illustrate parameter use.

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 'Execute Python code or script file in IDA Pro context.' It distinguishes from sibling tools like check_ida_connection and check_task_status by focusing on code execution with explicit examples.

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

Usage Guidelines5/5

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

The description explains when to use (to execute code in IDA) and when to use the sibling check_task_status tool for checking long-running scripts. Provides examples for default and specific instances, guiding the agent on proper usage.

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

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