For most part I have used metadata API but never had the need to explore Tooling API aspect of Salesforce. If you need to develop tools on metadata information from Salesforce this is the API to use.
We had a vendor move a lot of development to Production, the code coverage thru the Salesforce tools only indicated 22% code coverage while the vendor claimed to have 85% coverage.
I wondered if there was a way to crosscheck without to do a RunAll and that's where Tooling API came in handy.
Limitations: You can't use the queries in the normal sense from developer workbench; you have to go thru the RestExplorer approach.
However, you can use it in Developer console but then you can't export the data without having to do some hacks/
The Tooling API link is https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_api_tooling.htm
Here are 2 situations where I needed to use:
a) Find code coverage when Salesforce and vendor claims were different
b) After a RunAll what is the code coverage for every single class in your system.
For a) run the following from WorkBench--utilities--RestExlorer
/services/data/v44.0/tooling/query/?q="SELECT+ApexClassOrTrigger.Name+NumLinesCovered+ NumLinesUncovered+FROM+ApexCodeCoverageAggregate"
Ther results will be in JSON format.
Take the response and paste in a JSON translator and you should be able to view and download the
revised output for a better understanding
OR
from developer console run the query, pasted a sample below.
SELECT ApexClassOrTrigger.Name, NumLinesCovered, NumLinesUncovered
FROM ApexCodeCoverageAggregate
WHERE ApexClassOrTrigger.Name = <Name>
SELECT PercentCovered
FROM ApexOrgWideCoverage
SELECT NumLinesCovered, NumLinesUncovered
FROM ApexCodeCoverage
WHERE ApexClassOrTriggerId = <ID>
SELECT ApexClassOrTriggerId, ApexClassOrTrigger.Name, NumLinesCovered, NumLinesUncovered
FROM ApexCodeCoverageAggregate
WHERE ApexClassOrTriggerId != NULL AND ApexClassOrTrigger.Name != NULL
AND (NumLinesCovered > 0 OR NumLinesUncovered > 0) AND NumLinesCovered != NULL
AND NumLinesUncovered != NULL ORDER BY ApexClassOrTrigger.Name
SELECT ApexClassOrTriggerId, ApexClassOrTrigger.Name, NumLinesCovered, NumLinesUncovered
FROM ApexCodeCoverageAggregate
ORDER BY ApexClassOrTrigger.Name