run_ida_command
Execute IDA Pro scripts to automate reverse engineering and binary analysis tasks through the IDA Pro MCP Server.
Instructions
Execute an IDA Pro Script (IdaPython, Version IDA 8.3)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | script |
Implementation Reference
- index.ts:425-471 (handler)MCP tool handler for 'run_ida_command': validates arguments using isValidRunIdaArgs, executes the IDA script via IDARemoteClient.executeScript, and returns formatted text response with output or error.case 'run_ida_command': if (!isValidRunIdaArgs(request.params.arguments)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid run IDA command arguments' ); } try { const { script } = request.params.arguments; let result = await ida.executeScript(script); if (result.error) { return { content: [ { type: 'text', text: `Error executing IDA Pro script: ${result.error}`, }, ], isError: true, }; } return { content: [ { type: 'text', text: `IDA Pro Script Execution Results:\n\n${result.output}`, }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error executing IDA Pro command: ${error.message || error}`, }, ], isError: true, }; }
- index.ts:204-217 (registration)Registration of the 'run_ida_command' tool in the ListTools response, defining its name, description, and input schema requiring a 'script' string.{ name: 'run_ida_command', description: 'Execute an IDA Pro Script (IdaPython, Version IDA 8.3)', inputSchema: { type: 'object', properties: { script: { type: 'string', description: 'script', } }, required: ['script'], }, },
- index.ts:27-33 (schema)TypeScript interfaces defining arguments for IDA command tools; RunIdaDirectCommandArgs matches 'run_ida_command' input with 'script' field.interface RunIdaCommandArgs { scriptPath: string; outputPath?: string; } interface RunIdaDirectCommandArgs { script: string; }
- index.ts:89-95 (schema)Runtime validation function for 'run_ida_command' arguments, checking for object with non-null 'script' string property.const isValidRunIdaArgs = (args: any): args is RunIdaDirectCommandArgs => { return ( typeof args === 'object' && args !== null && (typeof args.script === 'string') ); };
- idaremoteclient.ts:283-286 (helper)Core helper function called by the tool handler; sends the script via POST to IDA remote API '/execute' endpoint and returns ExecuteResponse.async executeScript(script: string, logHTTP = false): Promise<ExecuteResponse> { return this.post<ExecuteResponse>('/execute', { script }); }