Function calling vs prompt for data

Hi,
Let’s suppose I want to use chat completion to generate a response based on some data (which does not change based on parameters). Is there a difference between implementing a function call that returns that data and inserting the data directly into the system prompt?

Example with a function call:

System: When requested, list the user names by calling “get_users”.
User: Give me the user names.
Function call → “get_users”
Function call response: [{"id":1, "name": "tom"},{"id":2, "name": "sam"}]

Example with direct data injection:

System: When requested, list the user names from this list: [{"id":1, "name": "tom"},{"id":2, "name": "sam"}]
User: Give me the user names.

Obviously, in cases where user names may or may not be requested, injecting the data directly into the prompt wastes tokens. However, I wanted to understand whether there is any difference in response quality.
Thanks!

+1 I had a similar question yesterday.