Can I guess where you are going with this?
That’s a valid use of a local function too, if provided with the right inputs that the LLM can decide upon.
You could not only provide an output of a local function but do some local processing too to change local state and return a representation of that state to the LLM as needed.