Initial commit: forge-tools-proxmox — MCP-сервер для Proxmox VE
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"git.totmin.ru/en2zmax/forge-toolkit"
|
||||
"github.com/modelcontextprotocol/go-sdk/mcp"
|
||||
)
|
||||
|
||||
// toolkit.go — тонкие адаптеры к общему слою forge-toolkit.
|
||||
// Локальные имена сохранены, чтобы хендлеры не зависели от пакета-источника.
|
||||
|
||||
func requestArgs(req *mcp.CallToolRequest) map[string]any {
|
||||
return toolkit.RequestArgs(req)
|
||||
}
|
||||
|
||||
func getString(args map[string]any, key, def string) string {
|
||||
return toolkit.GetString(args, key, def)
|
||||
}
|
||||
|
||||
func requireString(args map[string]any, key string) (string, error) {
|
||||
return toolkit.RequireString(args, key)
|
||||
}
|
||||
|
||||
func getInt(args map[string]any, key string, def int) int {
|
||||
return toolkit.GetInt(args, key, def)
|
||||
}
|
||||
|
||||
func getBool(args map[string]any, key string, def bool) bool {
|
||||
return toolkit.GetBool(args, key, def)
|
||||
}
|
||||
|
||||
func schema(properties map[string]any, required []string) map[string]any {
|
||||
return toolkit.Schema(properties, required)
|
||||
}
|
||||
|
||||
func strProps(desc string, required bool, enum ...string) map[string]any {
|
||||
return toolkit.StrProps(desc, required, enum...)
|
||||
}
|
||||
|
||||
func intProps(desc string, required bool) map[string]any {
|
||||
return toolkit.IntProps(desc, required)
|
||||
}
|
||||
|
||||
func boolProps(desc string, required bool) map[string]any {
|
||||
return toolkit.BoolProps(desc, required)
|
||||
}
|
||||
|
||||
func objectProps(desc string, required bool) map[string]any {
|
||||
return toolkit.ObjectProps(desc, required)
|
||||
}
|
||||
|
||||
func textResult(text string) *mcp.CallToolResult {
|
||||
return toolkit.Text(text)
|
||||
}
|
||||
|
||||
func errorResult(msg string) *mcp.CallToolResult {
|
||||
return toolkit.Error(msg)
|
||||
}
|
||||
|
||||
// patternsFn — forge-probe эмиттер паттернов (см. toolkit.PatternsFn).
|
||||
type patternsFn = toolkit.PatternsFn
|
||||
|
||||
func registerPatternTool(s *mcp.Server, tool *mcp.Tool, fn patternsFn, h mcp.ToolHandler) {
|
||||
toolkit.RegisterPatternTool(s, tool, fn, h)
|
||||
}
|
||||
Reference in New Issue
Block a user