Infer real tool type via querying relevant database tables. The root cause for incorrect `type` field is still not clear.