Skip to main content
Glama

search_byte_sequence

Locate specific byte sequences in binary files to identify patterns, code sections, or data structures during reverse engineering analysis.

Instructions

Search for a byte sequence in the binary

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bytesYesByte sequence to search for (e.g., "90 90 90" for three NOPs)
startAddressNoStart address for search (optional)
endAddressNoEnd address for search (optional)

Implementation Reference

  • MCP tool handler for 'search_byte_sequence': validates input, calls IDARemoteClient.searchForByteSequence, and returns formatted results or error.
    case 'search_byte_sequence':
        if (!isValidSearchByteSequenceArgs(request.params.arguments)) {
            throw new McpError(
                ErrorCode.InvalidParams,
                'Invalid search byte sequence arguments'
            );
        }
    
        try {
            const { bytes, startAddress, endAddress } = request.params.arguments;
    
            const result = await ida.searchForByteSequence(bytes, {
                startAddress,
                endAddress
            });
    
            return {
                content: [
                    {
                        type: 'text',
                        text: `Found ${result.count} occurrences of byte sequence "${bytes}":\n\n${JSON.stringify(result.results, null, 2)
                            }`,
                    },
                ],
            };
        } catch (error: any) {
            return {
                content: [
                    {
                        type: 'text',
                        text: `Error searching for byte sequence: ${error.message || error}`,
                    },
                ],
                isError: true,
            };
        }
  • Core implementation of byte sequence search: constructs query parameters and makes HTTP GET request to the IDA Pro remote control API endpoint /search/bytes.
    async searchForByteSequence(
        byteSequence: string,
        options: {
            startAddress?: number | string;
            endAddress?: number | string;
        } = {}
    ): Promise<ByteSequenceSearchResponse> {
        const params = new URLSearchParams();
        params.append('bytes', byteSequence);
        
        if (options.startAddress !== undefined) {
            const startAddr = typeof options.startAddress === 'string'
                ? options.startAddress
                : options.startAddress.toString();
            params.append('start', startAddr);
        }
        
        if (options.endAddress !== undefined) {
            const endAddr = typeof options.endAddress === 'string'
                ? options.endAddress
                : options.endAddress.toString();
            params.append('end', endAddr);
        }
        
        return this.get<ByteSequenceSearchResponse>(`/search/bytes?${params.toString()}`);
    }
  • index.ts:288-309 (registration)
    MCP tool registration defining the 'search_byte_sequence' tool name, description, and input schema.
    {
        name: 'search_byte_sequence',
        description: 'Search for a byte sequence in the binary',
        inputSchema: {
            type: 'object',
            properties: {
                bytes: {
                    type: 'string',
                    description: 'Byte sequence to search for (e.g., "90 90 90" for three NOPs)',
                },
                startAddress: {
                    type: 'string',
                    description: 'Start address for search (optional)',
                },
                endAddress: {
                    type: 'string',
                    description: 'End address for search (optional)',
                },
            },
            required: ['bytes'],
        },
    },
  • TypeScript interface for input schema of search_byte_sequence tool arguments.
    interface SearchByteSequenceArgs {
        bytes: string;
        startAddress?: string | number;
        endAddress?: string | number;
    }
  • Type guard function to validate search_byte_sequence tool arguments.
    const isValidSearchByteSequenceArgs = (args: any): args is SearchByteSequenceArgs => {
        return (
            typeof args === 'object' &&
            args !== null &&
            typeof args.bytes === 'string'
        );
    };
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral information. It doesn't disclose whether this is a read-only operation, what permissions might be required, how results are returned (e.g., list of addresses), or any performance characteristics like search scope limitations.

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 wasted words. It's front-loaded with the core purpose and uses technical terminology appropriately for the domain without unnecessary elaboration.

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?

For a search tool with no annotations and no output schema, the description is insufficient. It doesn't explain what format results are returned in, whether searches are case-sensitive, how multiple matches are handled, or any limitations on search scope beyond the optional address parameters documented in the schema.

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%, so the schema already documents all three parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema, meeting the baseline for high schema coverage without adding extra value.

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

Purpose5/5

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

The description clearly states the specific action ('Search for a byte sequence') and target resource ('in the binary'), distinguishing it from sibling tools like search_text or search_immediate_value. It uses precise technical terminology appropriate for binary analysis.

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 like search_immediate_value or search_text, nor does it mention any prerequisites or contextual constraints. It simply states what the tool does without indicating appropriate use cases.

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