get_disassembly
Retrieve disassembly for a specified address range in IDA Pro, enabling reverse engineering and binary analysis tasks with ease.
Instructions
Get disassembly for an address range
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of instructions to disassemble (optional) | |
| endAddress | No | End address for disassembly (optional) | |
| startAddress | Yes | Start address for disassembly |
Implementation Reference
- index.ts:602-646 (handler)MCP tool handler for 'get_disassembly': validates arguments, calls IDARemoteClient.getDisassembly, formats and returns the disassembly response.case 'get_disassembly': if (!isValidGetDisassemblyArgs(request.params.arguments)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid disassembly arguments' ); } try { const { startAddress, endAddress, count } = request.params.arguments; if (startAddress && typeof startAddress == 'string') { startAddress.replace("00007", "0x7") } if (endAddress && typeof endAddress == 'string') { endAddress.replace("00007", "0x7") } const result = await ida.getDisassembly(startAddress, { endAddress, count }); return { content: [ { type: 'text', text: `Disassembly from ${result.start_address}${result.end_address ? ` to ${result.end_address}` : ''}:\n\n${JSON.stringify(result.disassembly, null, 2) }`, }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error getting disassembly: ${error.message || error}`, }, ], isError: true, }; }
- index.ts:310-331 (registration)Tool registration in ListTools response, including name, description, and input schema.{ name: 'get_disassembly', description: 'Get disassembly for an address range', inputSchema: { type: 'object', properties: { startAddress: { type: 'string', description: 'Start address for disassembly', }, endAddress: { type: 'string', description: 'End address for disassembly (optional)', }, count: { type: 'number', description: 'Number of instructions to disassemble (optional)', }, }, required: ['startAddress'], }, },
- index.ts:55-59 (schema)TypeScript interface defining input arguments for get_disassembly.interface GetDisassemblyArgs { startAddress: string | number; endAddress?: string | number; count?: number; }
- index.ts:121-127 (schema)Validator function for GetDisassemblyArgs input.const isValidGetDisassemblyArgs = (args: any): args is GetDisassemblyArgs => { return ( typeof args === 'object' && args !== null && (typeof args.startAddress === 'string' || typeof args.startAddress === 'number') ); };
- idaremoteclient.ts:524-550 (helper)IDARemoteClient.getDisassembly method: constructs API request to IDA Pro remote server /disassembly endpoint and returns disassembly response.async getDisassembly( startAddress: number | string, options: { endAddress?: number | string; count?: number; } = {} ): Promise<DisassemblyResponse> { const params = new URLSearchParams(); const startAddr = typeof startAddress === 'string' ? startAddress : startAddress.toString(); params.append('start', startAddr); if (options.endAddress !== undefined) { const endAddr = typeof options.endAddress === 'string' ? options.endAddress : options.endAddress.toString(); params.append('end', endAddr); } if (options.count !== undefined) { params.append('count', options.count.toString()); } return this.get<DisassemblyResponse>(`/disassembly?${params.toString()}`); }