Right now arguments aren't checked at all. If the wrong type is passed in, weird things will probably happen. We should use the .json files that Google has for the API interfaces to check argument types. This would also simplify the handling of optional arguments.
Link to how Google does this.
Here's a sample JSON file: https://code.google.com/p/chromium/codesearch#chromium/src/chrome/common/extensions/api/windows.json&sq=package:chromium&type=cs&l=121