Gradle Tooling API - to get direct dependencies and potentially update them

Hi Gradle Community,

I’m exploring with Tooling API to find a solution to update existing Gradle build files. I’m targeting the Java Projects for the time being. Using IdeaProject or EclipseProject model i’m able to get the dependencies but the list includes transitive dependencies too which is not what i want.

Q1: Is there a way to get only direct dependencies in build file? (filtering out transitive dependencies)

Q2: Does Tooling API provides a way to update the models (eventually build files) ?

Thanks