Skip to main content
Glama

能力自检(本服务能做什么、哪条通道现在通)

capabilities
Read-onlyIdempotent

Check available debug channels and built-in modules before starting Keil debugging, so AI avoids using unavailable features.

Instructions

冷启动第一步的能力自检:一次看清这台上有什么可用、以及每条通道当前通不通,避免 AI 拿不存在的功能去试错。返回四块:

  1. channels:两条调试通道的可用性——uvsock(交互式,需 Keil 运行且 UVSOCK 已开)与 uv4_cmdline(UV4 -d 批处理,不依赖 UVSOCK);附各自实测结论与何时该用哪条。

  2. modules:本服务内置模块是否就绪——uvprojx 编辑、CMSIS-SVD 解码、Keil 报错知识库(含已实测的命令错误码条数)、串口监视、构建器等。

  3. env:UV4 路径、默认工程、符号文件来源、端口、工具裁剪设置。

  4. tool_surface:当前暴露的工具数(受 MDKDEBUG_TOOLSETS 影响),以及推荐工作流。 与 keil_health 的分工:keil_health 做诊断(坏了帮你定位坏在哪一环),capabilities 做枚举(有什么、哪条路现在能走)。 【输出控制】本工具返回体可能较大,额外接受三个可选参数:compact=true(精简)/ max_lines=N(限制列表条数)/ full=true(强制全量)。默认都不传=行为不变;被裁掉的内容一定会在返回体的 output 字段里如实上报(truncated/dropped/trimmed/hint),不会静默丢数据。也可用环境变量 MDKDEBUG_COMPACT=1 / MDKDEBUG_MAX_LINES=N 设全局默认。 【参数】必填: 无;可选: compact, max_lines, full 【调用示例】{}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fullNo强制返回全量:忽略 compact/max_lines 与对应环境变量的默认值。当上面两项让你只看到部分数据、而你要据此下结论时,用它取回完整结果。
compactNo精简返回体:去掉空值字段,把列表元素中取值完全相同的字段提到 output.shared,并把 usage/note/hints 之类**说明性**长文本截断到 200 字符(数值与内容字段不动)。被裁掉的东西都会列在 output 里,绝不静默丢弃。不传则不改行为(受 MDKDEBUG_COMPACT 影响)。
max_linesNo限制返回的列表条数(只作用于元素为对象的列表,如 results/items/tools):最多 N 条,其余丢弃并在 output.truncated/dropped/hint 里如实上报。0 或省略=不限(受 MDKDEBUG_MAX_LINES 影响)。

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.8

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false, and the description is fully consistent with them (no contradiction). Beyond that, it adds rich behavioral context the annotations cannot express: the output payload can be large with an output-control mechanism, truncated/dropped/trimmed content is always reported in the output field (never silently discarded), env vars MDKDEBUG_COMPACT/MDKDEBUG_MAX_LINES affect defaults, and channel availability depends on Keil runtime and UVSOCK state.

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 core purpose is front-loaded in the first sentence ('冷启动第一步的能力自检'), and every subsequent block — four return sections, keil_health differentiation, output-control rules, parameter summary — earns its place. The output-control paragraph is long, but justified given this tool returns large payloads and obeys environment variables. Minor redundancy exists between the description body and the input-schema parameter texts.

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

Completeness5/5

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

Given the tool's complexity — an output schema documenting return values, complete annotations covering safety/idempotence, and three optional parameters — the description is complete. An agent has everything needed to call it correctly: what it returns (4 sections), when to call it (cold-start first), how sizing controls behave and interplay with env vars, and the guarantee of no silent data truncation. The presence of an output schema relieves the description of explaining return-value shapes.

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 100%, so each of the three parameters (full, compact, max_lines) is already documented in the schema, giving a baseline of 3. The description adds real value beyond the schema by explaining how the params interact with each other and with the environment variables (defaults, precedence, 'default not passed = unchanged behavior'), and by clarifying that dropped content is reported rather than silently lost. It slightly exceeds the baseline but the schema still carries the core burden.

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 states a specific verb-plus-resource pair: '能力自检' (capability self-check) enumerated across four concrete return sections (channels, modules, env, tool_surface). It explicitly differentiates itself from the sibling keil_health ('keil_health 做诊断, capabilities 做枚举'), so an agent can distinguish it without opening either schema.

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

Usage Guidelines5/5

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

The description is explicit about when to invoke it: '冷启动第一步' (first step on cold-start) before trying features the agent might not have. It names the alternative keil_health and gives the exact selection criterion (diagnosis vs enumeration), and even advises which of the two debug channels to use per scenario (uvsock needs Keil running with UVSOCK open vs uv4_cmdline which does not depend on UVSOCK).

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