Skip to main content
Glama

get_xrefs_to

Find cross-references to a specific address in IDA Pro to analyze code and data relationships during reverse engineering.

Instructions

Get cross-references to an address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesTarget address to find references to
typeNoType of references to find (code, data, all)

Implementation Reference

  • MCP tool handler for 'get_xrefs_to': validates input, calls IDARemoteClient.getXrefsTo, formats and returns the response.
    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, }; }
  • TypeScript interface defining the input arguments for the get_xrefs_to tool.
    interface GetXrefsToArgs { address: string | number; type?: 'code' | 'data' | 'all'; }
  • index.ts:372-389 (registration)
    Registration of the 'get_xrefs_to' tool in the MCP server, including name, description, and input schema.
    { 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'], }, },
  • IDARemoteClient helper method that performs HTTP GET to the IDA Pro server /xrefs/to endpoint to fetch cross-references.
    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()}`); }
  • Type guard function to validate input arguments for get_xrefs_to tool.
    const isValidGetXrefsToArgs = (args: any): args is GetXrefsToArgs => { return ( typeof args === 'object' && args !== null && (typeof args.address === 'string' || typeof args.address === 'number') ); };

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/fdrechsler/mcp-server-idapro'

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