Skip to content
docsv0.2.0

PolicyRuleProviderInterface

Supplies policy rules to the PolicyGate. The Doctrine-backed provider lives in the host; in-memory or config-backed providers are equally valid. Returning null means "no matching rule" and the gate falls back to its channel policies.

PolicyRuleProviderInterface::findMatchingRule()

abstract public function findMatchingRule(string $channel, ?string $principal, string $toolName, bool $mutating): ?Milpa\ToolRuntime\Contracts\PolicyRuleInterface

Find the policy rule that governs this call, if any. Returning null means "no matching rule" — the gate falls back to its static channel policies rather than treating the absence of a rule as an implicit denial.

Parameters

Parameters of findMatchingRule()
NameTypeDescription
$channelstringChannel the call originated from (cli, mcp, telegram, web, ...)
$principal(string | null)Authenticated principal (user or service), if any
$toolNamestringName of the tool being invoked
$mutatingboolWhether the tool call mutates state