Question: I tried to implement compaction

I was planning to implement compaction using the prepareStep. Which goes like I would check the usage of the latest steps and if the input token is greater than the my CONTEXT_LIMIT I would perform pruning**(pruneMessages).** But the issue is that prepareStep does not have the usage parameter. So I was wondering how do you people handle cases where the tools called might return huge data which could be greater than a models available context