Skip to main content
Glama

search_text

Find specific text strings within binary files during reverse engineering analysis. Specify search parameters like case sensitivity and address ranges to locate code or data patterns.

Instructions

Search for text in the binary

Input Schema

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

Implementation Reference

  • The handler function for the 'search_text' tool. Validates input using isValidSearchTextArgs, connects to MongoDB, queries the 'strings' collection for matching text using regex (case-insensitive), formats results with memory addresses and text, and returns them as tool content.
    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 input arguments for the search_text tool.
    interface SearchTextArgs {
        text: string;
        caseSensitive?: boolean;
        startAddress?: string | number;
        endAddress?: string | number;
    }
  • index.ts:262-287 (registration)
    Tool registration in the ListTools handler, including name, description, and input schema matching SearchTextArgs.
    {
        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'],
        },
    },
  • Validation function to check if arguments conform to SearchTextArgs interface, used in the handler.
    const isValidSearchTextArgs = (args: any): args is SearchTextArgs => {
        return (
            typeof args === 'object' &&
            args !== null &&
            typeof args.text === 'string'
        );
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states what the tool does ('search for text') without mentioning behavioral traits like whether it returns all matches or first match, if it's paginated, what happens if no text is found, or performance implications. For a search tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, directly stating the core functionality without unnecessary elaboration. Every word earns its place, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a search operation with 4 parameters, no annotations, and no output schema, the description is incomplete. It lacks information about return values (e.g., match addresses or counts), error conditions, or how results are formatted. For a tool with rich input schema but no other structured data, the description should provide more context to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, meaning all parameters are documented in the schema. The description adds no additional meaning beyond what's in the schema (e.g., it doesn't explain address formats or search algorithms). With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'search' and the target 'text in the binary', which is specific and understandable. However, it doesn't explicitly differentiate this from sibling tools like 'search_byte_sequence' or 'search_immediate_value', which likely search for different types of patterns in the binary. The purpose is clear but lacks sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'search_byte_sequence' for binary data or 'search_immediate_value' for numeric values, nor does it specify contexts where text search is preferred. Without any usage context or exclusions, the agent must infer based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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