This is often called Function calling or tool use where you provide the LLM the ability to execute API calls to external tools.
The prompt will looks like:
""" you are a professional medical history recorder, write a short summary about the user's medical history, use tool_call when possible.
the current user_id is: abcd12345 """
your tool_call description should be set clearly, looks like:
""" get medical history by given user_id """