Skip to main content

require_actor

Function require_actor 

Source
pub async fn require_actor(ctx: &McpContext) -> Result<ToolActor, McpError>
Expand description

Resolve the acting user for a tool call. Refuses machine agents (CMS writes need an accountable user) and keys whose owner is gone or deactivated — fail-closed, mirroring the admin session checks.

Public so a host application’s own tools gate the same way. A host that reimplemented this would have to duplicate the user lookup and the active check, and the first thing to drift would be the fail-closed behaviour.