Skip to main content
Glama

Parse Frame

parse_frame

Parse a raw protocol frame hex into structured fields with byte offsets and evidence. Supports Modbus, FINS, MELSEC, S7; auto-detects direction and explains malformed frames for diagnostics.

Instructions

把一帧报文 hex 逐字段结构化解析 (不需要连接设备)。

每个字段带 byte_offset 与 raw_hex 证据; 支持正常请求/响应与异常 响应帧; 畸形帧不抛错, 而是尽量解析并在 errors 里说明哪里坏 —— "解析失败的方式"本身是诊断证据。 direction: "auto" 按帧结构判别, 也可显式传 "req" / "resp"。 frame_format (仅 melsec): "3e_binary" / "3e_ascii" / "4e_binary" / "4e_ascii"。

  • modbus: 异常帧/非 12 字节按响应, 12 字节按请求 (fc05/06 的响应 与请求逐字节相同, 任一解释一致)

  • fins: TCP 命令 0x00 按请求 / 0x01、0x02 按响应; 0x04 按 FINS ICF bit6 判别 (响应置位)

  • melsec: 副头部 50 00/54 00 按请求, D0 00/D4 00 按响应 (ASCII 帧 "5000"/"5400"/"D000"/"D400" 同理)

  • s7: rosctr=0x01 (Job) 按请求, 0x03 (Ack_Data) 按响应; 显式传 direction 时按传入值

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
protocolYes
directionNoauto
frame_hexYes
frame_formatNo3e_binary

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
validNo
errorsNo
fieldsNo
protocolYes
directionYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.4.0

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations provided, the description carries the full disclosure burden and does so thoroughly: no device connection, malformed frames do not throw but return errors, and each field includes byte_offset and raw_hex evidence. It also discloses per-protocol direction heuristics, giving an agent an accurate model of how the tool behaves in edge cases.

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

Conciseness4/5

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

The description is front-loaded with a one-sentence summary, then extends into necessary protocol-specific rules in a structured list. It is long, but each section serves a distinct purpose; a small amount of tightening could remove minor redundancy across the protocol examples.

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?

Given that an output schema exists and the tool handles multiple protocols, the description covers the essential behavioral and parameter context well. The main gaps are the missing explicit list of accepted protocol identifiers and frame_hex formatting details (whitespace, '0x' prefixes, case), which an agent may need to construct valid input.

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

Parameters4/5

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

Schema coverage is 0%, so the description compensates by explaining direction values ('auto', 'req', 'resp'), frame_format values ('3e_binary' etc.), and per-protocol classification logic. It does not enumerate accepted protocol values or the exact hex string format for frame_hex, but the core meaning of each parameter is well conveyed.

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 opens with '把一帧报文 hex 逐字段结构化解析', which names the exact action (parse), resource (a single frame hex), and result (field-by-field structured output). It also states '不需要连接设备', distinguishing it from device-connecting tools. This clearly separates it from siblings like parse_pcap and validate_frame.

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?

It provides clear context: this is an offline parser for one frame, and it explains when to override direction ('auto' vs explicit 'req'/'resp') and when frame_format applies (only melsec). It does not explicitly name sibling alternatives or say when not to use this tool, but the conditions are sufficiently implied by the scope and protocol-specific guidance.

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

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/ymxc152/plctap'

If you have feedback or need assistance with the MCP directory API, please join our Discord server