fix: expose write_file and document one-click operations
Release / Build & Release (push) Canceled after 0s
Release / Build & Release (push) Canceled after 0s
This commit is contained in:
@@ -286,6 +286,7 @@ func (s *Server) handleRequest(ctx context.Context, r *http.Request, req JSONRPC
|
||||
InputSchema: InputSchema{Type: "object", Properties: map[string]PropertyDef{"device": {Type: "string", Description: "目标节点名称"}, "path": {Type: "string", Description: "目标文件路径"}, "old_text": {Type: "string", Description: "必须唯一匹配的原文本块"}, "new_text": {Type: "string", Description: "替换后的文本块"}}, Required: []string{"path", "old_text", "new_text"}},
|
||||
},
|
||||
{
|
||||
Name: "write_file",
|
||||
Description: "向指定受控节点创建或覆写文件",
|
||||
InputSchema: InputSchema{
|
||||
Type: "object",
|
||||
|
||||
@@ -82,6 +82,23 @@ func TestMCPInitializeAndListTools(t *testing.T) {
|
||||
if !ok || len(tools) != 11 {
|
||||
t.Fatalf("expected 11 tools, got %d", len(tools))
|
||||
}
|
||||
foundWriteFile := false
|
||||
for _, raw := range tools {
|
||||
tool, ok := raw.(map[string]any)
|
||||
if !ok {
|
||||
t.Fatalf("tool entry is not an object: %#v", raw)
|
||||
}
|
||||
name, _ := tool["name"].(string)
|
||||
if name == "" {
|
||||
t.Fatalf("tool entry has empty name: %#v", tool)
|
||||
}
|
||||
if name == "write_file" {
|
||||
foundWriteFile = true
|
||||
}
|
||||
}
|
||||
if !foundWriteFile {
|
||||
t.Fatalf("write_file missing from tools/list")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMCPCallTool(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user