Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: AI Agent https://github.com/siyuan-note/siyuan/issues/17797

Daniel595334544303
diff --git a/kernel/mcp/tools/notebook.go b/kernel/mcp/tools/notebook.go
index f3c0f36f02..e04f7ca141 100644
--- a/kernel/mcp/tools/notebook.go
+++ b/kernel/mcp/tools/notebook.go
@@ -23,6 +23,7 @@ import (
"github.com/siyuan-note/siyuan/kernel/model"
"github.com/siyuan-note/siyuan/kernel/sql"
+ "github.com/siyuan-note/siyuan/kernel/util"
)
var NotebookTool = &Tool{
@@ -127,7 +128,7 @@ func notebookOpen(args map[string]interface{}) (CallToolResult, error) {
return CallToolResult{Content: []ContentItem{{Type: "text", Text: "id is required"}}, IsError: true}, nil
}
- _, err := model.Mount(id)
+ existed, err := model.Mount(id)
if err != nil {
return CallToolResult{Content: []ContentItem{{Type: "text", Text: "open notebook failed: " + err.Error()}}, IsError: true}, nil
}
@@ -137,6 +138,15 @@ func notebookOpen(args map[string]interface{}) (CallToolResult, error) {
sql.FlushQueue()
}
+ if box := model.Conf.Box(id); nil != box {
+ evt := util.NewCmdResult("mount", 0, util.PushModeBroadcast)
+ evt.Data = map[string]any{
+ "box": box,
+ "existed": existed,
+ }
+ util.PushEvent(evt)
+ }
+
return CallToolResult{Content: []ContentItem{{Type: "text", Text: "notebook opened: " + id}}}, nil
}