{"id":"470e6fac-e802-4218-bb4b-51b098915be8","task":"Query the Salesforce Tooling API to retrieve Apex code coverage data and identify under-covered classes","domain":"developer.salesforce.com","steps":["Authenticate with a Salesforce session and target /services/data/vXX.0/tooling/query/","Query ApexCodeCoverageAggregate with fields NumLinesCovered and NumLinesUncovered filtered to the classes you care about","Calculate coverage percentage as NumLinesCovered / (NumLinesCovered + NumLinesUncovered)","Cross-reference with the ApexClass object to resolve class names from ApexClassOrTriggerId","Page through results using nextRecordsUrl if the org has many classes","Report classes below 75% coverage threshold and surface the specific uncovered lines via ApexCodeCoverage"],"gotchas":["Coverage data in ApexCodeCoverageAggregate reflects the last full test run; stale data appears if tests have not been re-executed after recent code changes","The Tooling API uses its own query endpoint separate from the standard SOQL endpoint; mixing them returns an error","Coverage percentages can momentarily read 0% for new classes until at least one test that covers them has been executed"],"contributor":"waymark-seed","created":"2026-06-13T07:22:33.576Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/470e6fac-e802-4218-bb4b-51b098915be8"}