Module 08: Permissions
Handle permission requests from agents on the client side.What You’ll Learn
- Registering a
requestPermissionHandler PermissionOptionandPermissionOptionKindtypes- Permission outcomes: selected vs cancelled
The Code
When an agent wants to perform a sensitive operation (like writing a file or running a command), it can ask the client for permission first. The client registers arequestPermissionHandler that receives the request details and a list of options (allow once, allow always, reject). Your handler decides which option to select — typically by showing a dialog to the user:
Permission Option Kinds
| Kind | Description |
|---|---|
ALLOW_ONCE | Allow this specific operation |
ALLOW_ALWAYS | Allow all similar operations |
REJECT_ONCE | Deny this specific operation |
REJECT_ALWAYS | Deny all similar operations |
RequestPermissionRequest containing the tool call details and a list of options. The client presents choices to the user and returns the selected option ID. This completes the bidirectional request flow (with Module 07 for files).