Class: PermissionManager
Defined in: permissions/manager.ts:130
PermissionManager handles tool-level permission checks
Constructors
Constructor
new PermissionManager(options?): PermissionManager;
Defined in: permissions/manager.ts:144
Parameters
| Parameter | Type |
|---|---|
options | PermissionManagerOptions |
Returns
PermissionManager
Accessors
isEnabled
Get Signature
get isEnabled(): boolean;
Defined in: permissions/manager.ts:447
Check if permissions are enabled
Returns
boolean
size
Get Signature
get size(): number;
Defined in: permissions/manager.ts:440
Get the number of rules
Returns
number
Methods
addRule()
addRule(rule): this;
Defined in: permissions/manager.ts:168
Add a permission rule
Parameters
| Parameter | Type |
|---|---|
rule | ToolPermission |
Returns
this
check()
check(toolName, input): Promise<PermissionCheckResult>;
Defined in: permissions/manager.ts:231
Check if a tool has permission to execute
Parameters
| Parameter | Type | Description |
|---|---|---|
toolName | string | Name of the tool |
input | Record<string, unknown> | Tool input arguments |
Returns
Promise<PermissionCheckResult>
Permission check result
checkAndProceed()
checkAndProceed(toolName, input): Promise<{
proceed: boolean;
result: PermissionCheckResult;
}>;
Defined in: permissions/manager.ts:311
Check and handle permission, returning whether to proceed
Convenience method that combines check() with handling
Parameters
| Parameter | Type |
|---|---|
toolName | string |
input | Record<string, unknown> |
Returns
Promise<{ proceed: boolean; result: PermissionCheckResult; }>
clearSessionGrants()
clearSessionGrants(): void;
Defined in: permissions/manager.ts:374
Clear all session-level permissions
Returns
void
getAllRules()
getAllRules(): ToolPermission[];
Defined in: permissions/manager.ts:218
Get all permission rules
Returns
getLevel()
getLevel(toolName): PermissionLevel;
Defined in: permissions/manager.ts:411
Get the effective permission level for a tool
Parameters
| Parameter | Type |
|---|---|
toolName | string |
Returns
getRule()
getRule(toolName): ToolPermission | undefined;
Defined in: permissions/manager.ts:200
Get a permission rule by tool name
Parameters
| Parameter | Type |
|---|---|
toolName | string |
Returns
ToolPermission | undefined
getSessionGrants()
getSessionGrants(): string[];
Defined in: permissions/manager.ts:381
Get all tools with session-level permission
Returns
string[]
grantSession()
grantSession(toolName): void;
Defined in: permissions/manager.ts:360
Grant session-level permission for a tool
This allows the tool to execute for the remainder of the session without asking again.
Parameters
| Parameter | Type |
|---|---|
toolName | string |
Returns
void
hasSessionGrant()
hasSessionGrant(toolName): boolean;
Defined in: permissions/manager.ts:388
Check if a tool has session-level permission
Parameters
| Parameter | Type |
|---|---|
toolName | string |
Returns
boolean
onEvent()
onEvent(handler): () => void;
Defined in: permissions/manager.ts:419
Register an event handler
Parameters
| Parameter | Type |
|---|---|
handler | PermissionEventHandler |
Returns
() => void
removeRule()
removeRule(toolName): boolean;
Defined in: permissions/manager.ts:185
Remove a permission rule by tool name
Parameters
| Parameter | Type |
|---|---|
toolName | string |
Returns
boolean
revokeSession()
revokeSession(toolName): boolean;
Defined in: permissions/manager.ts:367
Revoke session-level permission for a tool
Parameters
| Parameter | Type |
|---|---|
toolName | string |
Returns
boolean
setLevel()
setLevel(
toolName,
level,
description?): this;
Defined in: permissions/manager.ts:397
Set the permission level for a tool
Convenience method for adding/updating a rule
Parameters
| Parameter | Type |
|---|---|
toolName | string |
level | PermissionLevel |
description? | string |
Returns
this