Files
spellforge/Tools/godot-mcp-pro/server/build/tools/export-tools.js
T
joywayerandClaude Opus 4.8 e65066a8fb chore: 重命名 Tools/godot-mcp-pro-v1.15.1 → Tools/godot-mcp-pro,更新 .mcp.json
- 去掉版本号后缀,路径更稳定(后续更新工具不必再改 .mcp.json)
- .mcp.json 指向新路径 server/build/index.js
- server 依赖已 npm install 就绪;node_modules 由 .gitignore 忽略,未入库

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 15:37:18 +08:00

36 lines
1.8 KiB
JavaScript

import { z } from "zod";
import { formatErrorForMcp } from "../utils/errors.js";
export function registerExportTools(server, godot) {
server.tool("list_export_presets", "List all export presets configured in export_presets.cfg", {}, async () => {
try {
const result = await godot.sendCommand("list_export_presets");
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
}
catch (e) {
return { content: [{ type: "text", text: formatErrorForMcp(e) }], isError: true };
}
});
server.tool("export_project", "Get the export command for a preset (direct export from editor is not supported in Godot 4)", {
preset_name: z.string().optional().describe("Export preset name"),
preset_index: z.number().optional().describe("Export preset index (alternative to name)"),
debug: z.boolean().optional().describe("Debug export (default: true)"),
}, async (params) => {
try {
const result = await godot.sendCommand("export_project", params);
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
}
catch (e) {
return { content: [{ type: "text", text: formatErrorForMcp(e) }], isError: true };
}
});
server.tool("get_export_info", "Get export-related project info (executable path, templates, project path)", {}, async () => {
try {
const result = await godot.sendCommand("get_export_info");
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
}
catch (e) {
return { content: [{ type: "text", text: formatErrorForMcp(e) }], isError: true };
}
});
}
//# sourceMappingURL=export-tools.js.map