score:6
Matrix is your best bet for this type of stuff, and it will still be a sub-optimal two-step optimization:
First I'd try to find the intercontinental leg of your flight, i.e. the one that brings you to Tokyo, and we are basically free to start from anywhere. I once asked a similar question
Flight Search from anywhere to a specific destination
but for caveats explained below, I suggest another trick:
In Matrix pick an airport that is central, i.e. if you were looking to have your stop-over in Europe use FRA and select the Nearby option, choose maximum radius and hit Select all.
This gives you a list of cheap intermediate destinations.
In a second step you can now (manually) filter those for how much you would like to spend time there and for how cheap it is to get there, using the search tool of your choice.
I'm afraid this does not answer your question in the sense of is there a tool? but it is the best solution to your problem. If you are asking me explicitly for the tool, two sites I presented in a different answer, azair and kiwi, would be good tools, but they fail for intercontinental travel and looking this far ahead.