Initial commit: omnichannel-mcp — MCP-сервер управления платформой Omnichannel
ci / test (push) Successful in 2m22s
ci / lint (push) Successful in 4m31s

This commit is contained in:
Maksim Totmin
2026-10-07 20:13:23 +07:00
commit fdbd4a4fb6
54 changed files with 5672 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
package tools
import (
"context"
"github.com/modelcontextprotocol/go-sdk/mcp"
)
// maintain.go — обслуживание: очистка старых версий.
func registerMaintainTools(s *mcp.Server) {
// cleanup_old_versions не эмитит паттерн по конкретному ресурсу: операция
// затрагивает всю БД версий, поэтому используем release-паттерн стенда.
addPatternTool(s, &mcp.Tool{
Name: "cleanup_old_versions",
Description: "Удалить версии compose/env и логи миграций старше N дней (текущие версии не трогаются). Разрушительно: требует confirm=\"true\".",
InputSchema: schema(map[string]any{
"server": serverProp(),
"days": intProps("Порог в днях (по умолчанию 90)", false),
"confirm": boolProps("Подтверждение разрушительной операции (обязательно true)", true),
}, []string{"confirm"}),
}, releasePatterns, func(ctx context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error) {
args := requestArgs(req)
if res := confirmGate(args, "cleanup_old_versions"); res != nil {
return res, nil
}
days := getInt(args, "days", 90)
if days <= 0 {
return errorResult("days должен быть положительным"), nil
}
api, res := openAPI(ctx, args, true)
if res != nil {
return res, nil
}
defer api.Close()
return result(api.CleanupOldVersions(ctx, days))
})
}