To get a list of defined variables in the template check here. It was the first one for a google search.
How to get list of all variables in jinja 2 templates
You can take this list and filter what you supplied to the render function. Ideally, I find it easiest to supply a dictionary. It should be easy to reduce your inputs once you have the list as shown in the above answer.
For your other question.
If you really want to throw an exception if myvar is not passed I would do it before rendering and passing a dictionary to jinja.
something like this
template_vars = {}
if myvar in template_vars:
template.render(template_vars)
else:
raise Exception('missing myvar')
Alternatively, you could use an if statement in your template to not render that section if myvar is not present like so:
{% if myvar %}
<t1>{{ myvar }}<t1>
{% endif %}
It will just render as blank if myvar is missing from the dictionary provided to the jinja render method. Or put a message that it was missing as shown below.
{% if myvar %}
<t1>{{ myvar }}<t1>
{% else %}
<t1> myvar was not supplied <t1>
{% endif %}