MCPcopy Index your code
hub / github.com/ZToolsCenter/ZTools / setupIPC

Method setupIPC

src/main/api/plugin/tools.ts:60–72  ·  view source on GitHub ↗

* 接收 preload 中的工具注册请求,并同步记录到主进程状态。

()

Source from the content-addressed store, hash-verified

58 * 接收 preload 中的工具注册请求,并同步记录到主进程状态。
59 */
60 private setupIPC(): void {
61 ipcMain.on('plugin:tool-register', (event, toolName: string) => {
62 try {
63 this.registerTool(event.sender, toolName)
64 event.returnValue = { success: true }
65 } catch (error: unknown) {
66 event.returnValue = {
67 success: false,
68 error: error instanceof Error ? error.message : '工具注册失败'
69 }
70 }
71 })
72 }
73
74 /**
75 * 从插件目录读取并筛选合法的 tools 声明。

Callers 1

initMethod · 0.95

Calls 2

registerToolMethod · 0.95
onMethod · 0.80

Tested by

no test coverage detected