refactor: 全面转向 CLI 驱动架构与底层 SDK,裁撤繁杂 MCP 工具并参考 seal-home 规范

This commit is contained in:
gitea committed 2026-08-27 10:56:45 +08:00
1 parent 3d549e2e2f
commit e7aa8a86cc
19 files changed
+1228 -589

No files matched your search

+8 -159
View File
@@ -5,152 +5,13 @@ import {
listAllWorkflows,
findWorkflowsByTaskType,
} from "./services.js";
import { WorkflowStateSchema } from "./types.js";
// ── Tool 定义 ─────────────────────────────────────────────────────────────────
// ── 精简核心 MCP Tools (其余功能均由 CLI 和底层 SDK 直接提供) ──────────────────
export const platformTools = [
{
name: "platform_list",
description: "列出企业下所有启用的自建应用",
parameters: z.object({}),
handler: async ({ ekbClient, corp }: PlatformClients) => {
return await api.listPlatforms(ekbClient, corp.credentials.corpId);
},
},
{
name: "platform_workflow_list",
description: "列出指定自建应用下的工作流(EASO)",
parameters: z.object({
platformId: z.string().describe("自建应用 ID"),
page: z.number().optional().describe("页码,默认 1"),
pageSize: z.number().optional().describe("每页数量,默认 20"),
}),
handler: async (
{ easoClient }: PlatformClients,
params: { platformId: string; page?: number; pageSize?: number }
) => {
return await api.listWorkflows(
easoClient,
params.platformId,
params.page,
params.pageSize
);
},
},
{
name: "platform_workflow_stats",
description: "获取指定自建应用的工作流统计信息(EASO)",
parameters: z.object({
platformId: z.string().describe("自建应用 ID"),
}),
handler: async (
{ easoClient }: PlatformClients,
params: { platformId: string }
) => {
return await api.getWorkflowStats(easoClient, params.platformId);
},
},
{
name: "platform_workflow_charge",
description: "查询企业工作流用量配额(EASO)",
parameters: z.object({}),
handler: async ({ easoClient }: PlatformClients) => {
return await api.getWorkflowCharge(easoClient);
},
},
{
name: "platform_workflow_detail",
description: "获取工作流详情(Piper)",
parameters: z.object({
pipelineId: z.string().describe("工作流 ID"),
}),
handler: async (
{ easoClient }: PlatformClients,
params: { pipelineId: string }
) => {
return await api.getWorkflowDetail(easoClient, params.pipelineId);
},
},
{
name: "platform_workflow_toggle",
description: "启用或停用工作流(Piper)。state=1 启用,state=0 停用",
parameters: z.object({
pipelineId: z.string().describe("工作流 ID"),
state: WorkflowStateSchema.describe("状态:1 启用,0 停用"),
}),
handler: async (
{ easoClient }: PlatformClients,
params: { pipelineId: string; state: 0 | 1 }
) => {
return await api.toggleWorkflow(easoClient, params.pipelineId, params.state);
},
},
{
name: "platform_workflow_jobs",
description: "查询工作流运行中的任务(Piper)",
parameters: z.object({
pipelineId: z.string().describe("工作流 ID"),
runType: z.enum(["DEBUG", "PROD"]).optional().describe("运行类型,默认 DEBUG"),
}),
handler: async (
{ easoClient }: PlatformClients,
params: { pipelineId: string; runType?: "DEBUG" | "PROD" }
) => {
return await api.listRunningJobs(easoClient, params.pipelineId, params.runType);
},
},
{
name: "platform_workflow_dsl",
description: "获取工作流 DSL 配置列表(Piper)",
parameters: z.object({}),
handler: async ({ easoClient }: PlatformClients) => {
return await api.listDsl(easoClient);
},
},
{
name: "platform_workflow_staffs",
description: "获取企业员工列表(Piper)",
parameters: z.object({
external: z.boolean().optional().describe("是否包含外部人员,默认 false"),
}),
handler: async (
{ easoClient }: PlatformClients,
params: { external?: boolean }
) => {
return await api.listStaffs(easoClient, params.external);
},
},
{
name: "platform_workflow_webhook",
description: "获取工作流 Webhook 信息(Piper)",
parameters: z.object({
pipelineId: z.string().describe("工作流 ID"),
}),
handler: async (
{ easoClient }: PlatformClients,
params: { pipelineId: string }
) => {
return await api.getWebhookInfo(easoClient, params.pipelineId);
},
},
{
name: "platform_workflow_sample",
description: "获取工作流测试/采样数据(Piper)",
parameters: z.object({
pipelineId: z.string().describe("工作流 ID"),
}),
handler: async (
{ easoClient }: PlatformClients,
params: { pipelineId: string }
) => {
return await api.sampleWorkflowData(easoClient, params.pipelineId);
},
},
{
name: "platform_workflow_list_all",
description:
"跨所有启用自建应用汇总工作流列表,返回带 platformId/platformName 的扁平结果",
description: "跨所有启用自建应用汇总工作流列表,返回带 platformId/platformName 的聚合结果",
parameters: z.object({
page: z.number().optional().describe("页码,默认 1"),
pageSize: z.number().optional().describe("每页数量,默认 20"),
@@ -163,28 +24,16 @@ export const platformTools = [
},
},
{
name: "platform_workflow_find_by_task",
description:
"跨所有启用自建应用查找包含指定节点类型的工作流,递归扫描嵌套 tasks",
name: "platform_workflow_detail",
description: "获取工作流节点与 DSL 配置详情",
parameters: z.object({
taskType: z.string().describe("节点类型,如 http、code-js2、every、condition"),
page: z.number().optional().describe("页码,默认 1"),
pageSize: z.number().optional().describe("每页数量,默认 20"),
includeDetail: z
.boolean()
.optional()
.describe("是否先调用详情接口获取完整节点后再匹配,默认 false"),
pipelineId: z.string().describe("工作流 ID"),
}),
handler: async (
clients: PlatformClients,
params: {
taskType: string;
page?: number;
pageSize?: number;
includeDetail?: boolean;
}
{ easoClient }: PlatformClients,
params: { pipelineId: string }
) => {
return await findWorkflowsByTaskType(clients, params.taskType, params);
return await api.getWorkflowDetail(easoClient, params.pipelineId);
},
},
];