Skip to main content
Glama

Infer a binary format from samples

re_struct
Read-onlyIdempotent

Compare 2–32 same-format samples side by side to infer field layout, lengths, counts, checksums, timestamps, offsets, and text boundaries, then draft a Kaitai Struct schema.

Instructions

Give 2 to 32 files of the same unknown format (saves, levels, packets, custom archives). Compares them side by side and returns the layout as fields with the evidence for each: bytes that are the same in every sample (magic, version, padding), numbers that follow the file size or the bytes after them (lengths), counts of fixed-size records (count x record size = what follows) with the columns of the record table (whole numbers, floats, ids that rise), CRC-32/Adler-32 fields and what they cover, MD5/SHA-1/SHA-256 or CRC trailers, Unix times, offsets that land on the same bytes in every sample, and text with a length in front or a NUL behind it. A text of a different length per sample does not end the comparison: every sample keeps its own cursor. Also returns a Kaitai Struct (.ksy) draft. A hypothesis from the samples given: more samples that differ in one known thing sharpen it. Read-only; it decrypts and decompresses nothing.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "re_struct"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNoOr: a folder with the samples (use match to pick them).
filesNoSample files of the same format.
matchNoWith path: only files matching, e.g. "*.sav" or /slot\d+\.dat/.
maxKBNoKiB of each sample to read (default 1024). Checksums over the whole file need the whole file.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.26.2

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, so the safety profile is covered before the description starts. The description adds real context beyond that: it decrypts and decompresses nothing, its answer is a hypothesis bounded by the samples given, and per-sample cursors survive differing text lengths. It still says little about cost or limits on large sample sets, so it is good but not rich.

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

Conciseness3/5

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

The purpose is buried after an imperative about supplying files, and the middle is a long comma-chained enumeration of detectable field types that reads as a wall of text without structure. Nearly every clause is substantive, but the density makes it harder to scan than a short lead sentence followed by grouped detail would be.

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

Completeness4/5

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

There is no output schema, so the description must carry the return contract, and it does: fields with per-sample evidence, derived relationships (lengths, counts x record size, checksum coverage, offsets), plus a .ksy draft. For a high-complexity inference tool this is close to complete, with only output shape details and runtime expectations left implicit.

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%, including maxItems 32, the path+match pairing, and the note that whole-file checksums require reading the whole file, so the baseline of 3 applies. The prose restates the 2-32 bound and the sample-quality idea but adds no per-parameter syntax or format detail the schema does not already carry.

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 names a specific verb and resource ('compares them side by side and returns the layout as fields with the evidence for each') over a precisely bounded input ('2 to 32 files of the same unknown format'), and states the concrete artifact produced (a Kaitai Struct .ksy draft). It is immediately clear what the tool does, though it never names a sibling such as re_compare or re_binary to mark the boundary explicitly.

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

Usage Guidelines4/5

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

Input preconditions are explicit (files must share one unknown format; 2-32 samples) and it gives operational guidance on sample quality: 'more samples that differ in one known thing sharpen it.' It stops short of when-not-to-use guidance or naming an alternative tool for cases where samples are unavailable or the format is already known.

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