Skip to main content
Glama

Detect Device

detect_device
Read-onlyIdempotent

Identify PLC protocol on a host by scanning open ports and probing protocol fingerprints. Returns confidence-ranked candidates with verified next steps for reading.

Instructions

设备自动识别: 给定 host 自动扫端口并判定协议 (v0.4, 全程只读)。

流程: 并发扫描候选端口 (缺省 102/502/2000/2404/44818/4840/5007/6000/9600/9601, 单端口连接预算 0.5s) -> 开放端口并发跑已注册协议 probe 指纹 (单协议预算 timeout_ms/1000, 缺省 0.8s; 个别协议有独立预算如 opcua 的完整会话握手) -> high 候选按协议做一次最小读验证 (deep=True 缺省; 成功升级 verified, 失败留痕保持 high; deep=False 跳过验证读)。 只读保证: 全程只发握手帧 + 最小读帧, 不写任何数据; 且识别 ≠ 可访问 —— 例如 S7 PUT/GET 被关闭时识别照样成功, 读 DB 仍可能失败。 返回 DetectResult: candidates 按置信度降序 (同级先验匹配端口优先, next_step 可直接作为 plc_read 调用), unknown_services 为开放但 已注册协议都不认识的端口 (可用 start_listener 钓帧分析)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deepNo
hostYes
portsNo
timeout_msNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostYes
candidatesYes
elapsed_msYes
open_portsYes
closed_countYes
scanned_portsYes
unknown_servicesYes
network_assessmentYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.0

TDQS

A4.2/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true and idempotentHint=true. The description goes beyond by explicitly guaranteeing read-only behavior (only handshake and minimal read frames, no writes), reveals optional deep verification, and explains that identification does not guarantee access. This adds significant behavioral context beyond annotations.

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?

Description is detailed and front-loaded with purpose, but it is lengthy with multiple clauses. It covers essential details without excessive fluff, but could be more compact. Structure is logical: purpose, flow, assurances, return format.

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 the tool's complexity and output schema exists, the description covers main workflow, parameter semantics, and return behavior. It doesn't detail edge cases like host unreachable or all ports closed, but is adequate for an agent to invoke correctly.

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 description coverage is 0%, so the description must explain parameters. It explains deep (default true, performs minimal read verification), ports (default list of candidate ports, null likely means use defaults), timeout_ms (per-probe budget, default 0.8s), and host (target device). This adds meaning beyond the schema for all parameters.

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?

States a specific action: auto-scan ports and identify protocol for a given host. The description distinguishes it from siblings like probe_device by clarifying it is read-only and focused on identification, not probing. However, the exact protocol detection scope is implicit but clear enough.

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?

Provides detailed workflow and default ports, and clarifies the tool is for identification, not full access verification. It mentions that if S7 PUT/GET is closed, read may fail, implying use for reconnaissance. Does not explicitly state when to use alternatives like probe_device or plc_read, but context is fairly clear.

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