refactor: unify tool reason requirements

This commit is contained in:
2026-10-28 16:43:04 +08:00
parent 7d47a2df86
commit c3050b602b
20 changed files with 97 additions and 46 deletions
+2 -1
View File
@@ -1,7 +1,8 @@
import { optionalToolReason } from "../tool-reason.js";
import { tool } from "../tool.js";
import { executeFrontendAction } from "./frontend_action.js";
export default tool({
description: "显示受控折线或柱状图并等待浏览器回执。不接收 ECharts 脚本或任意 option;数据须来自可信查询或用户输入。",
args: { title: tool.schema.string().max(200), chart_type: tool.schema.enum(["line", "bar"]), x_data: tool.schema.array(tool.schema.string().max(128)).min(1).max(100), series: tool.schema.array(tool.schema.object({ name: tool.schema.string().max(128), data: tool.schema.array(tool.schema.number().finite()).min(1).max(100) })).min(1).max(8), reason: tool.schema.string().max(2000) },
args: { title: tool.schema.string().max(200), chart_type: tool.schema.enum(["line", "bar"]), x_data: tool.schema.array(tool.schema.string().max(128)).min(1).max(100), series: tool.schema.array(tool.schema.object({ name: tool.schema.string().max(128), data: tool.schema.array(tool.schema.number().finite()).min(1).max(100) })).min(1).max(8), reason: optionalToolReason },
async execute(args, context) { return executeFrontendAction("show_chart", args, context); },
});