get_xrefs_to
Identify cross-references to a specified address in IDA Pro, filtering by code, data, or all types for precise reverse engineering and binary analysis.
Instructions
Get cross-references to an address
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | Target address to find references to | |
| type | No | Type of references to find (code, data, all) |
Implementation Reference
- index.ts:780-814 (handler)MCP CallToolRequest handler for 'get_xrefs_to': validates arguments using isValidGetXrefsToArgs, calls ida.getXrefsTo, returns formatted text content with xrefs or error.case 'get_xrefs_to': if (!isValidGetXrefsToArgs(request.params.arguments)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid get xrefs to arguments' ); } try { const { address, type } = request.params.arguments; const result = await ida.getXrefsTo(address, { type: type as 'code' | 'data' | 'all' }); return { content: [ { type: 'text', text: `Found ${result.count} references to ${result.address} (${result.name}):\n\n${JSON.stringify(result.xrefs, null, 2) }`, }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error getting xrefs to address: ${error.message || error}`, }, ], isError: true, }; }
- index.ts:373-389 (registration)Tool registration in ListToolsRequestSchema response: defines name 'get_xrefs_to', description, and inputSchema for MCP protocol.name: 'get_xrefs_to', description: 'Get cross-references to an address', inputSchema: { type: 'object', properties: { address: { type: 'string', description: 'Target address to find references to', }, type: { type: 'string', description: 'Type of references to find (code, data, all)', }, }, required: ['address'], }, },
- index.ts:67-70 (schema)TypeScript interface defining the expected arguments for get_xrefs_to tool.interface GetXrefsToArgs { address: string | number; type?: 'code' | 'data' | 'all'; }
- index.ts:137-143 (helper)Type guard function to validate GetXrefsToArgs input before handling the tool call.const isValidGetXrefsToArgs = (args: any): args is GetXrefsToArgs => { return ( typeof args === 'object' && args !== null && (typeof args.address === 'string' || typeof args.address === 'number') ); };
- idaremoteclient.ts:472-490 (helper)IDARemoteClient helper method that sends HTTP GET request to IDA Pro remote server /xrefs/to endpoint to retrieve cross-references to the specified address.async getXrefsTo( address: number | string, options: { type?: 'code' | 'data' | 'all'; } = {} ): Promise<XrefsResponse> { const params = new URLSearchParams(); const addr = typeof address === 'string' ? address : address.toString(); params.append('address', addr); if (options.type !== undefined) { params.append('type', options.type); } return this.get<XrefsResponse>(`/xrefs/to?${params.toString()}`); }