Skip to main content
Glama
andy-qingcai

PPK2 MCP Server

by andy-qingcai

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
PPK2_MOCKNo1 = 内存模拟设备(无硬件演示/CI)。默认关闭。0
PPK2_PORTNo指定串口(跳过探测)。默认自动发现。
PPK2_TIMEOUTNo普通操作超时(秒)。15
PPK2_DATA_DIRNo采集 npz 保存目录。./data
PPK2_CAPTURE_MAX_SNocapture 工具时长上限(长采集用 start/stop)。60

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
list_devicesA

扫描串口并探测 PPK2(以 0x19 元数据应答识别命令口)。

返回候选端口列表;无硬件时返回空列表(可用 PPK2_MOCK=1 演示)。

connectA

连接 PPK2 并读取元数据(校准系数、Calibrated 标志、VDD)。

port 缺省自动发现。连接后可用 get_status 查看校准状态。

disconnectA

断开串口(采样中会先停止)。

get_statusB

会话快照:连接/身份/模式/VDD/采集进行中状态/校准标志。

raw_commandA

逃生舱:发送原始命令字节(hex,如 "19" 读元数据)并回收响应。

含 0x20(RESET,会触发 USB 重枚举)时必须 confirm=true。 采样进行中不可用。

set_modeA

设置测量模式:AMPERE(电流表,外部供电)或 SOURCE(源表,PPK2 给 DUT 供电)。

SOURCE 模式采集前还需 set_source_voltage。

set_source_voltageA

设置电压(mV,800-5000,域外自动夹紧)。

SOURCE 模式:稳压器实际输出;AMPERE 模式:作为电流换算的 VDD 估计值。

set_dut_powerB

DUT 电源开关(SOURCE 模式下接通/切断输出,等价官方 app 电源按钮)。

set_resistor_rangeA

锁定量程 0-4(0 最灵敏 ~nA 级,4 最大 ~A 级);默认自动量程。

rng=null 恢复自动(固件无原生恢复命令,通过重切当前模式实现)。

set_spike_filteringB

硬件尖峰滤波开关(官方默认开;影响换程尖峰的平滑)。

captureA

定长采集(阻塞,≤60s):采样→落盘 npz→返回统计+包络+路径。

这是功耗分析的主入口。返回 stats(mean/min/max/charge/energy)、 envelope(~1000 点 min/max/mean 概览)、meta(含丢样数)与文件路径。 capture_id 仅限字母数字._-。

start_captureA

启动长采集(后台,不阻塞;可>60s)。之后用 get_capture_status 查看, stop_capture 结束并落盘。

stop_captureB

停止长采集并落盘,返回与 capture 相同的摘要。

get_capture_statusA

进行中采集的实时状态:已采样本数/丢失数/速率/时长。

list_capturesA

列出历史采集(npz 元数据表:时长/速率/丢样/路径),按时间倒序。

analyze_captureA

离线分析历史采集:全窗或 [start_s,end_s] 子窗的统计+包络(无需连接设备)。

返回 mean/min/max/median/charge(µC)/energy(µJ)与包络。

detect_activity_segmentsB

功耗分段(阈值滞回):按 threshold_ua 分 active/sleep 段。

返回每段起止/均值/电量与 active 占空比——回答"睡眠电流多少、 活动占空比多少"类问题。min_duration_s 过滤毛刺段。

estimate_battery_lifeB

电池续航估算:按均值电流对若干容量(mAh)估算小时/天。

数据来源二选一:capture_id(自动取窗口均值电流)或直接给 mean_ua。 capacities_mah 缺省 [120, 240, 500, 1000, 2400]。

read_logic_channelsB

8 路逻辑输入口分析(与电流同步采样)。

mode="stats":高电平占比/边沿数;mode="edges":分页边沿表 (offset/limit,level_after 判向)。channel 0-7。

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources