Close the tool loop safely with a typed dispatcher for two bounded tools. Unknown tools become structured errors, never arbitrary code execution.
Required APIdef dispatch_tool(name, args):
return result_or_errorBehaviorThink through the mechanism first if you want the extra reasoning step. It never blocks the editor.
dispatch_tool('add', {'a': 15, 'b': 37})a valid tool call returns the tool result
dispatch_tool('multiply', {'a': 3, 'b': 4})dispatch selects the requested operation
2 hidden edge tests run after the visible contract passes.
Run Tests to see the contract verdicts here.