Skip to documentation
SLOP

tiny.acp.PermissionPolicy

Reference tiny.acp PermissionPolicy

Defined in client.

A caller that trusts some tools lists them here, so the client grants those requests without asking the observer.

API (2)

Fields and members

Public fields and members.

No direct callersNo direct callsclientPermissionPolicy
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/acp/src/client.zig:320

zig
/// A caller that trusts some tools lists them here, so the client grants those requests without/// asking the observer. The client checks two lists when the observer leaves a request unanswered:/// tool kinds and tool-title prefixes. A request passes when its tool call's kind equals a listed/// kind, or its title starts with a listed prefix. For a request that passes, the client picks the/// first `allow_once` option, else the first `allow_always` option. Otherwise, or when allow/// options are absent, the client picks the first `reject_once` option, else the last/// `reject_always` option, else answers `cancelled`. The default lists nothing, so it rejects every/// request.pub const PermissionPolicy = struct {    /// Tool kinds to grant, each compared whole against the tool call's `kind`. The package test    /// grants `execute`. The field defaults to none.    allowed_tool_kinds: []const []const u8 = &.{},    /// Title prefixes to grant, each compared against the start of the tool call's `title`. The    /// package test grants an MCP tool call titled `mcp__fixture__tool`, which carries no kind,    /// with the prefix `mcp__fixture__`. The field defaults to none.    allowed_title_prefixes: []const []const u8 = &.{},    fn allows(self: PermissionPolicy, object: std.json.ObjectMap) bool {        const params = json.objectObject(object, "params") orelse return false;        const tool_call = json.objectObject(params, "toolCall") orelse return false;        if (json.objectString(tool_call, "kind")) |kind| {            for (self.allowed_tool_kinds) |allowed| {                if (std.mem.eql(u8, allowed, kind)) return true;            }        }        if (json.objectString(tool_call, "title")) |title| {            for (self.allowed_title_prefixes) |prefix| {                if (std.mem.startsWith(u8, title, prefix)) return true;            }        }        return false;    }};

Source: lib/acp/src/root.zig:76

zig
pub const PermissionPolicy = client.PermissionPolicy;

Audit

Definitions1
Public names2
Members2
Version26.7.0
Revisiondaab053ee433