get_disassembly
Retrieve disassembled code for a specific address range in IDA Pro to analyze binary instructions and understand program behavior during reverse engineering.
Instructions
Get disassembly for an address range
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"startAddress": "<startAddress>"
},
"name": "get_disassembly"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| startAddress | Yes | Start address for disassembly | |
| endAddress | No | End address for disassembly (optional) | |
| count | No | Number of instructions to disassemble (optional) |
Implementation Reference
- index.ts:602-646 (handler)MCP CallToolRequestSchema handler case for 'get_disassembly' tool: validates input arguments, calls the IDA remote client to get disassembly, formats and returns the response or error.
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, }; } - idaremoteclient.ts:524-550 (helper)Core implementation of disassembly retrieval: constructs query parameters and makes HTTP GET request to IDA Pro remote server's /disassembly endpoint.
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()}`); } - index.ts:310-331 (registration)Tool registration in ListToolsRequestSchema response: defines name 'get_disassembly', description, and JSON 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 the input arguments for the get_disassembly tool.
interface GetDisassemblyArgs { startAddress: string | number; endAddress?: string | number; count?: number; } - index.ts:121-127 (helper)Type guard function to validate GetDisassemblyArgs input in the tool handler.
const isValidGetDisassemblyArgs = (args: any): args is GetDisassemblyArgs => { return ( typeof args === 'object' && args !== null && (typeof args.startAddress === 'string' || typeof args.startAddress === 'number') ); };