Use version defined in libs.version.toml outside the dependecies block

I have a libs.version.toml that include versions of the libraries my project uses:

[versions]
slf4j = "1.7.30"
grpc = "1.42.1"
protoc = "3.17.2"
...

But then, I cannot use such versions outside the dependencies plugin:

dependencies {
    api libs.slf4j
    api libs.bundles.grpc
}

protobuf {
    protoc {
        artifact = "com.google.protobuf:protoc:${protocVersion}"
    }
    plugins {
        grpc {
            artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
        }
    }
    generateProtoTasks {
        all()*.plugins {
            grpc {}
        }
    }
}

So here, I have to maintain some additional properties protocVersion and grpcVersion in my gradle.properties: is there a way to reference the version from libs.version.toml outside of the dependencies block ?

I can highly recommend using Kotlin DSL.
Having amazing IDE support and proper code completion is just amazing.
What you are after is libs.versions.grpc.get().
See Gradle User Manual: Version 7.3.1 example 317.