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

Method CheckVersionExists

internal/database/postgres.go:868–884  ·  view source on GitHub ↗

CheckVersionExists checks if a specific version exists for a server

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

Source from the content-addressed store, hash-verified

866
867// CheckVersionExists checks if a specific version exists for a server
868func (db *PostgreSQL) CheckVersionExists(ctx context.Context, tx pgx.Tx, serverName, version string) (bool, error) {
869 if ctx.Err() != nil {
870 return false, ctx.Err()
871 }
872
873 executor := db.getExecutor(tx)
874
875 query := `SELECT EXISTS(SELECT 1 FROM servers WHERE server_name = $1 AND version = $2)`
876
877 var exists bool
878 err := executor.QueryRow(ctx, query, serverName, version).Scan(&exists)
879 if err != nil {
880 return false, fmt.Errorf("failed to check version existence: %w", err)
881 }
882
883 return exists, nil
884}
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 {

Callers

nothing calls this directly

Calls 2

getExecutorMethod · 0.95
QueryRowMethod · 0.80

Tested by

no test coverage detected