Skip to main content
Glama

search_text

Locate specific text within a binary using IDA Pro's reverse engineering capabilities. Supports case-sensitive options and address range constraints for precise searches.

Instructions

Search for text in the binary

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
caseSensitiveNoWhether the search is case sensitive (default: false)
endAddressNoEnd address for search (optional)
startAddressNoStart address for search (optional)
textYesText to search for

Implementation Reference

  • Handler for the 'search_text' tool: validates input arguments, connects to a local MongoDB database, performs a case-insensitive regex search on the 'TEXT' field in the 'strings' collection, formats the results with memory addresses and text, and returns them.
    case 'search_text': if (!isValidSearchTextArgs(request.params.arguments)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid search text arguments' ); } try { const { text, caseSensitive, startAddress, endAddress } = request.params.arguments; /*const result = await ida.searchForText(text, { caseSensitive, startAddress, endAddress });*/ await client.connect(); db = client.db(dbName); collection = db.collection("strings"); let searchFor = "lua"; let newRegex = new RegExp(text, "i"); collection = db.collection("strings"); let res = await collection.find({ "TEXT": newRegex }) let result = await res.toArray() let result_count = result.length; let result_str = ""; for (let i = 0; i < result.length; i++) { result_str += ` ${result[i].MEMORY_ADDR} ${result[i].TEXT} \n` } return { content: [ { type: 'text', text: `Found ${result_count} \n\n ${result_str}`, }, ], } } catch (error: any) { return { content: [ { type: 'text', text: `Error searching for text: ${error.message || error}`, }, ], isError: true, }; } break;
  • TypeScript interface defining the expected input structure for the search_text tool arguments.
    interface SearchTextArgs { text: string; caseSensitive?: boolean; startAddress?: string | number; endAddress?: string | number; }
  • index.ts:262-287 (registration)
    Tool registration in the ListTools response, specifying name, description, and JSON inputSchema for validation.
    { name: 'search_text', description: 'Search for text in the binary', inputSchema: { type: 'object', properties: { text: { type: 'string', description: 'Text to search for', }, caseSensitive: { type: 'boolean', description: 'Whether the search is case sensitive (default: false)', }, startAddress: { type: 'string', description: 'Start address for search (optional)', }, endAddress: { type: 'string', description: 'End address for search (optional)', }, }, required: ['text'], }, },
  • Helper function to validate that the input arguments conform to SearchTextArgs (checks for object with non-null 'text' string property).
    const isValidSearchTextArgs = (args: any): args is SearchTextArgs => { return ( typeof args === 'object' && args !== null && typeof args.text === 'string' ); };

Other Tools

Related Tools

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