That's a basic tool call that current models already can do well. All the sql query generation LLMs can do this for example.