Execute only a typed arithmetic tool
Implement execute_tool(name, arguments) for exactly two tools, add and multiply. Each takes exactly a and b, exact integers in [-100,100]. Return {'ok': True, 'value': result} for success. Return {'ok': False, 'error': code} with code unknown_tool, invalid_shape, or invalid_value, checking in that order. Never evaluate text or dynamically import a callable.
Your task
- Complete the starter function using the contract above.
- Use the examples and visible tests to check normal inputs, boundaries, and rejected inputs.
- Run tests to record your result, then compare with the explained reference solution.
Examples
EXAMPLE 1
Inputexecute_tool("multiply", {"a": 6, "b": 7})
Output{"ok": true, "value": 42}
EXAMPLE 2
Inputexecute_tool("add", {"a": true, "b": 1})
Output{"ok": false, "error": "invalid_value"}
Implement the function, then run the tests.
Ctrl / ⌘ + Enter to test · Shift + Tab leaves editor