




























@@ -42,8 +42,14 @@ const CLI_DEBUG = isTruthyEnvValue(process.env.OPENCLAW_LIVE_CLI_BACKEND_DEBUG);
4242const CLI_CI_SAFE_CODEX_CONFIG = isTruthyEnvValue(
4343process.env.OPENCLAW_LIVE_CLI_BACKEND_USE_CI_SAFE_CODEX_CONFIG,
4444);
45+const CLI_MCP_SCHEMA_PROBE = isTruthyEnvValue(
46+process.env.OPENCLAW_LIVE_CLI_BACKEND_MCP_SCHEMA_PROBE,
47+);
4548const describeLive = LIVE && CLI_LIVE ? describe : describe.skip;
464950+const MCP_SCHEMA_PROBE_PLUGIN_ID = "mcp-schema-probe";
51+const MCP_SCHEMA_PROBE_TOOL_NAME = "mcp_schema_probe_no_args";
52+4753const DEFAULT_PROVIDER = "claude-cli";
4854const DEFAULT_MODEL =
4955resolveCliBackendLiveTest(DEFAULT_PROVIDER)?.defaultModelRef ?? "claude-cli/claude-sonnet-4-6";
@@ -64,6 +70,44 @@ function logCliBackendLiveStep(step: string, details?: Record<string, unknown>):
6470console.error(`[gateway-cli-live] ${step}${suffix}`);
6571}
667273+async function createMcpSchemaProbePlugin(tempDir: string): Promise<string> {
74+const pluginDir = path.join(tempDir, MCP_SCHEMA_PROBE_PLUGIN_ID);
75+await fs.mkdir(pluginDir, { recursive: true });
76+const pluginFile = path.join(pluginDir, "index.cjs");
77+await fs.writeFile(
78+path.join(pluginDir, "openclaw.plugin.json"),
79+`${JSON.stringify(
80+ {
81+ id: MCP_SCHEMA_PROBE_PLUGIN_ID,
82+ name: "MCP Schema Probe",
83+ description: "Live test plugin for no-argument MCP tool schemas",
84+ configSchema: { type: "object", properties: {} },
85+ },
86+ null,
87+ 2,
88+ )}\n`,
89+);
90+await fs.writeFile(
91+pluginFile,
92+`module.exports = {
93+ id: "${MCP_SCHEMA_PROBE_PLUGIN_ID}",
94+ name: "MCP Schema Probe",
95+ register(api) {
96+ api.registerTool({
97+ name: "${MCP_SCHEMA_PROBE_TOOL_NAME}",
98+ description: "Live test no-argument tool for MCP schema normalization",
99+ parameters: { type: "object" },
100+ async execute() {
101+ return { content: [{ type: "text", text: "schema probe ok" }] };
102+ },
103+ });
104+ },
105+};
106+`,
107+);
108+return pluginFile;
109+}
110+67111describeLive("gateway live (cli backend)", () => {
68112it(
69113"runs the agent pipeline against the local CLI backend",
@@ -151,6 +195,9 @@ describeLive("gateway live (cli backend)", () => {
151195const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-live-cli-"));
152196const stateDir = path.join(tempDir, "state");
153197await fs.mkdir(stateDir, { recursive: true });
198+const schemaProbePluginPath = CLI_MCP_SCHEMA_PROBE
199+ ? await createMcpSchemaProbePlugin(tempDir)
200+ : undefined;
154201process.env.OPENCLAW_STATE_DIR = stateDir;
155202const bundleMcp = backendResolved?.bundleMcp === true;
156203const bootstrapWorkspace =
@@ -180,6 +227,21 @@ describeLive("gateway live (cli backend)", () => {
180227const existingBackends = cfgWithCliBackends.agents?.defaults?.cliBackends ?? {};
181228const nextCfg = {
182229 ...cfg,
230+ ...(schemaProbePluginPath
231+ ? {
232+plugins: {
233+ ...cfg.plugins,
234+load: {
235+ ...cfg.plugins?.load,
236+paths: [...(cfg.plugins?.load?.paths ?? []), schemaProbePluginPath],
237+},
238+entries: {
239+ ...cfg.plugins?.entries,
240+[MCP_SCHEMA_PROBE_PLUGIN_ID]: { enabled: true },
241+},
242+},
243+}
244+ : {}),
183245gateway: {
184246mode: "local",
185247 ...cfg.gateway,
@@ -387,6 +449,9 @@ describeLive("gateway live (cli backend)", () => {
387449 token,
388450env: process.env,
389451senderIsOwner: true,
452+expectedSchemaProbeToolName: schemaProbePluginPath
453+ ? MCP_SCHEMA_PROBE_TOOL_NAME
454+ : undefined,
390455});
391456logCliBackendLiveStep("cron-mcp-loopback-preflight:done");
392457if (providerId === "codex-cli" && CLI_CI_SAFE_CODEX_CONFIG) {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。