Skip to main content
Glama

get_xrefs_from

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

Instructions

Get cross-references from an address

Input Schema

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

Implementation Reference

  • The core handler function getXrefsFrom in IDARemoteClient that performs HTTP GET request to IDA Pro remote server endpoint /xrefs/from to retrieve cross-references from the given address.
    async getXrefsFrom(
        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/from?${params.toString()}`);
    }
  • MCP server tool handler for 'get_xrefs_from': validates arguments, calls ida.getXrefsFrom, formats and returns the result.
    case 'get_xrefs_from':
        if (!isValidGetXrefsFromArgs(request.params.arguments)) {
            throw new McpError(
                ErrorCode.InvalidParams,
                'Invalid get xrefs from arguments'
            );
        }
    
        try {
            const { address, type } = request.params.arguments;
    
            const result = await ida.getXrefsFrom(address, {
                type: type as 'code' | 'data' | 'all'
            });
    
            return {
                content: [
                    {
                        type: 'text',
                        text: `Found ${result.count} references from ${result.address} (${result.name}):\n\n${JSON.stringify(result.xrefs, null, 2)
                            }`,
                    },
                ],
            };
        } catch (error: any) {
            return {
                content: [
                    {
                        type: 'text',
                        text: `Error getting xrefs from address: ${error.message || error}`,
                    },
                ],
                isError: true,
            };
        }
  • TypeScript interface defining the input arguments for get_xrefs_from tool.
    interface GetXrefsFromArgs {
        address: string | number;
        type?: 'code' | 'data' | 'all';
    }
  • index.ts:391-407 (registration)
    Tool registration in ListTools response, including name, description, and input schema.
        name: 'get_xrefs_from',
        description: 'Get cross-references from an address',
        inputSchema: {
            type: 'object',
            properties: {
                address: {
                    type: 'string',
                    description: 'Source address to find references from',
                },
                type: {
                    type: 'string',
                    description: 'Type of references to find (code, data, all)',
                },
            },
            required: ['address'],
        },
    },
  • Validation helper function to check if arguments match GetXrefsFromArgs interface.
    const isValidGetXrefsFromArgs = (args: any): args is GetXrefsFromArgs => {
        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