Skip to content

API Reference parrot.tools.scope

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.tools.scope

View source

Tool scope contract (FEAT-622 M3a): what a tool may read from studio_scope.

Class AgentScopeView

Satisfied by FEAT-605 StudioAgentRef.

Attributes:

Attribute Type Description
agent_id UUID | None
name str
owner str | None
tenant str | None
visibility str

Class CallerView

Satisfied by FEAT-605 RequestScope.

Attributes:

Attribute Type Description
user_id str | None
tenant str | None
groups frozenset[str]
is_superuser bool

Attribute ScopeRefusal

Attribute ToolAccess

Class ToolScopeUnavailable

Standard refusal of a tenant-bound tool / options provider.

Parameter Type Default Description
reason ScopeRefusal
tool_name str | None None

Attributes:

Attribute Type Description
code str
reason ScopeRefusal

Class ToolScopeView

Required shape of current_context().kwargs["studio_scope"].

Attributes:

Attribute Type Description
caller CallerView
agent AgentScopeView | None

Alias current_context

Re-exported from parrot.utils.helpers.current_context.

Function current_tool_scope

Return the bound studio_scope or None (no request context, or nothing bound).

current_tool_scope() -> ToolScopeView | None

Returns: ToolScopeView | None

Function ensure_tool_scope

No-op when not tenant-bound; otherwise :func:require_tool_scope (handlers, before construction).

ensure_tool_scope(cls_or_instance: type | object, *, tool_name: str | None = None) -> None

Parameter Type Default Description
cls_or_instance type | object
tool_name str | None None

Function is_tenant_bound

Effective flag: tenant_bound or a scope-sourced server-managed param; ToolkitTool inherits.

is_tenant_bound(cls_or_instance: type | object) -> bool

Parameter Type Default Description
cls_or_instance type | object

Returns: bool

Function require_tool_scope

Return (tenant, scope) or raise :class:ToolScopeUnavailable (spec "Scope rules" order).

require_tool_scope(*, tool_name: str | None = None) -> tuple[str, ToolScopeView]

Parameter Type Default Description
tool_name str | None None

Returns: tuple[str, ToolScopeView]

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally