Skip to content

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

:sparkles: Support Model Context Protocol (MCP) https://github.com/siyuan-note/siyuan/issues/13795

Daniel2f0fcb7bb413
diff --git a/kernel/cli/cmd/ref.go b/kernel/cli/cmd/ref.go
index b572df3239..6980b7c6d9 100644
--- a/kernel/cli/cmd/ref.go
+++ b/kernel/cli/cmd/ref.go
@@ -44,7 +44,7 @@ var refBacklinksCmd = &cobra.Command{
keyword, _ := cmd.Flags().GetString("keyword")
sortMode, _ := cmd.Flags().GetInt("sort")
- _, backlinks, _, count, _ := model.GetBacklink2(id, keyword, "", sortMode, 0, false)
+ _, backlinks, _, count, _ := model.GetBacklink2(id, keyword, "", sortMode, 0, model.Conf.Editor.BacklinkContainChildren)
switch outputFormat {
case "json":
@@ -71,7 +71,7 @@ var refMentionsCmd = &cobra.Command{
keyword, _ := cmd.Flags().GetString("keyword")
sortMode, _ := cmd.Flags().GetInt("sort")
- _, _, backmentions, _, count := model.GetBacklink2(id, "", keyword, 0, sortMode, false)
+ _, _, backmentions, _, count := model.GetBacklink2(id, "", keyword, 0, sortMode, model.Conf.Editor.BacklinkContainChildren)
switch outputFormat {
case "json":
diff --git a/kernel/mcp/tools/ref.go b/kernel/mcp/tools/ref.go
index 193f2f5c13..bdacd17e25 100644
--- a/kernel/mcp/tools/ref.go
+++ b/kernel/mcp/tools/ref.go
@@ -62,7 +62,7 @@ func refBacklinks(args map[string]interface{}) (CallToolResult, error) {
id, _ := args["id"].(string)
keyword, _ := args["keyword"].(string)
- _, backlinks, _, _, _ := model.GetBacklink2(id, keyword, "", 0, 0, false)
+ _, backlinks, _, _, _ := model.GetBacklink2(id, keyword, "", 0, 0, model.Conf.Editor.BacklinkContainChildren)
if len(backlinks) == 0 {
return CallToolResult{Content: []ContentItem{{Type: "text", Text: "no backlinks found"}}}, nil
}
@@ -79,7 +79,7 @@ func refMentions(args map[string]interface{}) (CallToolResult, error) {
id, _ := args["id"].(string)
keyword, _ := args["keyword"].(string)
- _, _, mentions, _, _ := model.GetBacklink2(id, "", keyword, 0, 0, false)
+ _, _, mentions, _, _ := model.GetBacklink2(id, "", keyword, 0, 0, model.Conf.Editor.BacklinkContainChildren)
if len(mentions) == 0 {
return CallToolResult{Content: []ContentItem{{Type: "text", Text: "no mentions found"}}}, nil
}