Data validation in functions

I am writing an assistant that helps users get information about an online role-playing game. A user might have one or more characters in the game. I have a function that the assistant can call if a user asks, for example, “What can you tell me about John Smith?”. However, if the user doesn’t have a character called John Smith, or the user asks, “What can you tell me about John?” the assistant makes the function call multiple times (I didn’t count, but I would guess maybe ten times) before giving up.

Is there a way to return an error code or text that will tell the assistant to reply to the user that it couldn’t find the character they are looking for, or to ask the user for more information?

I assume you wrote the code for the function? In that case you simply have the function return something like {“Error”: “No information about John Smith found”}
It doesn’t even matter what the exact format of the message as (as long as it is valid Json).

That’s what I tried at first

const returnVal = { 'error': "No information about " + charName + " found"}

But it just keeps calling the function. That’s what I’m trying to avoid. I check the run status every 5 seconds, it shows as in_progress, but then requires_action and calls the same function again (with the same arguments)