@uwa4d/openapi-mcp 0.2.0-beta.3 → 0.2.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tools.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { UwaApiError } from './client.js';
3
- import { versionGuideFor } from './version-guide.js';
3
+ import { INDICATOR_DASHBOARD_PANEL_GUIDE, versionGuideFor } from './version-guide.js';
4
4
  const ENGINE_LABEL = { unity: 'Unity', unreal: 'UE' };
5
5
  /**
6
6
  * 预签名数据默认完整返回,不按条数截断——实测各接口解压后在 10 KB ~ 500 KB 之间,
@@ -41,6 +41,10 @@ function describe(op) {
41
41
  const guide = versionGuideFor(op.id);
42
42
  if (guide)
43
43
  lines.push(guide);
44
+ else if (op.query.some((p) => p.name === 'indicatorDashboards')) {
45
+ // 带 indicatorDashboards 但未单独写 VERSION_GUIDE 的原子工具(兜底)
46
+ lines.push(INDICATOR_DASHBOARD_PANEL_GUIDE);
47
+ }
44
48
  const engines = op.engines.map((e) => ENGINE_LABEL[e]).join(' / ');
45
49
  lines.push(`适用引擎:${engines}|模块:${op.modules.join(',')}|${op.method} ${op.path}`);
46
50
  const sdk = op.variants.find((v) => v.sdkRequirement)?.sdkRequirement;
@@ -84,7 +88,15 @@ function describe(op) {
84
88
  export function buildInputSchema(op) {
85
89
  const shape = {};
86
90
  for (const p of [...op.query, ...op.body]) {
87
- const base = zodFor(p).describe(p.example ? `${p.description}(示例:${p.example})` : p.description);
91
+ let desc = p.description;
92
+ if (p.name === 'indicatorDashboards') {
93
+ desc = [
94
+ desc,
95
+ '传参名为面板标识符:后缀 _max/_avg 等为历史命名,不表示只能取峰值或均值。',
96
+ '例:temperature_max 可拿到整机/CPU/GPU/电池温度的曲线及 mean/max/min 统计(见映射表子指标 key)。',
97
+ ].join(' ');
98
+ }
99
+ const base = zodFor(p).describe(p.example ? `${desc}(示例:${p.example})` : desc);
88
100
  shape[p.name] = p.required ? base : base.optional();
89
101
  }
90
102
  if (op.apiVersions.length > 1) {
@@ -4,6 +4,11 @@
4
4
  * 集中手写、挂到 describe() 首段,避免散落在 notes 里被模型漏读。
5
5
  * 不塞进 docs/ 生成链路——刷新官方文档镜像不会冲掉这里。
6
6
  */
7
+ /**
8
+ * indicatorDashboards 传参名称说明(面板标识符,非统计维度后缀)。
9
+ * 挂到所有带 indicatorDashboards 的工具 description,避免模型见 _max 只读峰值。
10
+ */
11
+ export declare const INDICATOR_DASHBOARD_PANEL_GUIDE: string;
7
12
  /** 写入工具 description 的「选用规则」块,key 为 operation id。 */
8
13
  export declare const VERSION_GUIDE: Record<string, string>;
9
14
  export declare function versionGuideFor(opId: string): string | undefined;
@@ -4,6 +4,19 @@
4
4
  * 集中手写、挂到 describe() 首段,避免散落在 notes 里被模型漏读。
5
5
  * 不塞进 docs/ 生成链路——刷新官方文档镜像不会冲掉这里。
6
6
  */
7
+ /**
8
+ * indicatorDashboards 传参名称说明(面板标识符,非统计维度后缀)。
9
+ * 挂到所有带 indicatorDashboards 的工具 description,避免模型见 _max 只读峰值。
10
+ */
11
+ export const INDICATOR_DASHBOARD_PANEL_GUIDE = [
12
+ '【indicatorDashboards 传参名称——勿按后缀猜统计维度】',
13
+ '- 传参名(如 temperature_max、fps_avg、drawcall_cnt_max)是**面板标识符**,_max / _avg / @max 等为历史命名,**不限制**返回 mean / maximum / min 等统计类型。',
14
+ '- 例:temperature_max 面板含子指标 temperature、android_temper_cpu、android_temper_gpu、android_temper_battery;',
15
+ ' · 曲线接口(indicator_curve / custom_dashboard)→ 各子指标逐帧曲线;',
16
+ ' · 统计 2.0(indicator_statistic_dashboard)→ statistic 下 *_mean / *_maximum / *_min 及 scene_* 等全量统计。',
17
+ '- 查温度曲线/均值/峰值:Unity Overview 且 SDK ≥ 2.5.1 时传 indicatorDashboards=temperature_max,再读 y_axis 或 statistic;勿仅看 get_overview_statistic 的汇总段。',
18
+ '- UE Overview 当前 Open API 未开放 custom/indicator dashboard 路径(会 24052),UE 温度汇总见 get_ue_overview_statistic_v2 的 temperature 段。',
19
+ ].join('\n');
7
20
  /** 写入工具 description 的「选用规则」块,key 为 operation id。 */
8
21
  export const VERSION_GUIDE = {
9
22
  get_overview_statistic_v1: [
@@ -39,12 +52,14 @@ export const VERSION_GUIDE = {
39
52
  '- 自定义面板统计 1.0(抽帧曲线)。不支持 GPU 类面板。',
40
53
  '- 需要 GPU 指标或更多统计值类型时,改用 gotonline_overview_indicator_statistic_dashboard(2.0,需 SDK ≥ 2.5.1)。',
41
54
  '- 逐帧曲线用 gotonline_overview_indicator_curve_dashboard(2.0,最多 3 个面板)。',
55
+ INDICATOR_DASHBOARD_PANEL_GUIDE,
42
56
  ].join('\n'),
43
57
  gotonline_overview_indicator_statistic_dashboard: [
44
58
  '【选用规则——务必先看】',
45
59
  '- 自定义面板统计 2.0。需 SDK ≥ 2.5.1,支持 GPU 指标,最多 15 个面板。',
46
60
  '- 旧接口(抽帧、无 GPU)见 gotonline_overview_custom_dashboard。',
47
61
  '- 只要逐帧曲线不要统计值时用 gotonline_overview_indicator_curve_dashboard。',
62
+ INDICATOR_DASHBOARD_PANEL_GUIDE,
48
63
  ].join('\n'),
49
64
  gotonline_overview_indicator_curve_dashboard: [
50
65
  '【选用规则——务必先看】',
@@ -53,6 +68,12 @@ export const VERSION_GUIDE = {
53
68
  '- 【横轴——勿混用】外层 x_axis 为逐帧共享横轴(1、2、3…);y_axis.{指标名}.x_axis 为该曲线专属横轴(常见步长 30:0、30、60…)。',
54
69
  '- 读取某条曲线时:若存在专属 x_axis 必须用专属,否则才用外层共享 x_axis。把共享横轴套到 FPS 等专属曲线会错位。',
55
70
  '- 响应另含 _axisBinding / _axisHint,按其中 xAxisSource 取值即可。',
71
+ INDICATOR_DASHBOARD_PANEL_GUIDE,
72
+ ].join('\n'),
73
+ gotonline_gpu_curve: [
74
+ '【选用规则——务必先看】',
75
+ '- GPU 模式指标面板逐帧曲线,indicatorDashboards 为 GPU 面板映射表中的传参名称。',
76
+ INDICATOR_DASHBOARD_PANEL_GUIDE,
56
77
  ].join('\n'),
57
78
  gotonline_overview_memory_usage_snapshot: [
58
79
  '【选用规则——务必先看】',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uwa4d/openapi-mcp",
3
- "version": "0.2.0-beta.3",
3
+ "version": "0.2.0-beta.5",
4
4
  "description": "UWA 开放平台 MCP Server,将 UWA Open API 暴露为 MCP 工具供 AI 助手调用",
5
5
  "type": "module",
6
6
  "bin": {