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

Daniel1bf69a8de5b2
diff --git a/kernel/mcp/tools/sql.go b/kernel/mcp/tools/sql.go
index 5287e17756..4e1402aaf5 100644
--- a/kernel/mcp/tools/sql.go
+++ b/kernel/mcp/tools/sql.go
@@ -43,14 +43,16 @@ func init() {
func sqlHandler(args map[string]interface{}) (CallToolResult, error) {
action, _ := args["action"].(string)
- switch action {
- case "query":
- return sqlQuery(args)
+ if action != "query" {
+ if stmt, ok := args["stmt"].(string); ok && stmt != "" {
+ return sqlQuery(args)
+ }
+ return CallToolResult{
+ Content: []ContentItem{{Type: "text", Text: "unknown action '" + action + "', expected 'query'"}},
+ IsError: true,
+ }, nil
}
- return CallToolResult{
- Content: []ContentItem{{Type: "text", Text: "unknown action: " + action}},
- IsError: true,
- }, nil
+ return sqlQuery(args)
}
func sqlQuery(args map[string]interface{}) (CallToolResult, error) {