MCPcopy
hub / github.com/modelcontextprotocol/registry / UnmarkAsLatest

Method UnmarkAsLatest

internal/database/postgres.go:887–902  ·  view source on GitHub ↗

UnmarkAsLatest marks the current latest version of a server as no longer latest

(ctx context.Context, tx pgx.Tx, serverName string)

Source from the content-addressed store, hash-verified

885
886// UnmarkAsLatest marks the current latest version of a server as no longer latest
887func (db *PostgreSQL) UnmarkAsLatest(ctx context.Context, tx pgx.Tx, serverName string) error {
888 if ctx.Err() != nil {
889 return ctx.Err()
890 }
891
892 executor := db.getExecutor(tx)
893
894 query := `UPDATE servers SET is_latest = false WHERE server_name = $1 AND is_latest = true`
895
896 _, err := executor.Exec(ctx, query, serverName)
897 if err != nil {
898 return fmt.Errorf("failed to unmark latest version: %w", err)
899 }
900
901 return nil
902}
903
904// SetLatestVersion sets is_latest=true on the given version and false on all other versions
905// of the same server. Passing an empty version clears is_latest for all rows.

Callers

nothing calls this directly

Calls 2

getExecutorMethod · 0.95
ExecMethod · 0.80

Tested by

no test coverage detected